ray sn0w
ray sn0w

Reputation: 1209

Composer permission denied (publickey)

I Have a private repo on BitBucket, Im trying to install on localhost using composer install, here is my composer.json file:

{
"repositories": [
    {
        "type": "git",
        "url":  "[email protected]:username/repo.git"
    }
]
}

When I run composer install from the command line I get:

[RuntimeException] Failed to execute git clone --mirror "[email protected]:username/repo.git" "C:/Users/...../" Cloning into bare repository 'C:/Users/.....'... Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

My key pair has an passphrase but composer never asks for it, I am running windows 10 with the Pageant client running and the correct key selected.

Also there is a config file with this data:

Host bitbucket.org
IdentityFile ~/.ssh/openssh (yes my key name is openssh)

The funny thing is that if I copy and paste this command:

git clone --mirror "[email protected]:username/repo.git"

I do get ask for my passphrase and after that it start cloning the Repo.

What could be wrong? most information about this error refers directly for git commands, but in my case they work, what is not working is composer, what am i doing wrong?

Upvotes: 5

Views: 13401

Answers (3)

chris
chris

Reputation: 1

Having faced the same issue as described by OP, I too tried to follow the instructions on Why git can't remember my passphrase under Windows

But I limited my steps to these:

  1. Run PuTTY's pageant.exe, open your .ppk file ("Add Key"), and provide your passphrase for your key.
  2. Access Windows' environment variables dialog (Right-click on "Computer", Click on "Properties", Click on "Advanced system settings" or the "Advanced" tab, click on "Environment Variables"). Add the following environment variable:

    GIT_SSH=C:\full\path\to\plink.exe

After the restarting the command line tool (important to have the new env variables take effect) it worked.

Upvotes: 0

smitrovic
smitrovic

Reputation: 461

I had the same problem and answer from this post helped me Why git can't remember my passphrase under Windows

All I did was to run 'start-ssh-agent' in CMD and provide password.

Third solution Assumes Window, msysgit, and native command prompt.

Install msysgit

Make sure to allow git to be used on the MS-DOS

command prompt Run start-ssh-agent

Enter SSH passphrases

All done! Git commands should now work in the native command prompt.

Upvotes: 12

Pᴇʜ
Pᴇʜ

Reputation: 57683

1. Make sure your public key is loaded into Bitbucket Cloud

  1. Open a browser and log into Bitbucket Cloud.
  2. Choose Username > Manage Account from the menu bar. The system displays the Account settings page.
  3. Click SSH keys. The SSH Keys page displays. It shows a list of any existing keys.
  4. If your key is not listed set one up.

2. Make sure your identity is loaded into your SSH Agent

Open Pageant to view loaded keys. If your key is not in the list click Add Key.

You can test which key you are sending

ssh -T [email protected]

Upvotes: 4

Related Questions