Composer permission denied (publickey)

a 夏天 提交于 2019-12-24 01:56:14

问题


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":  "git@bitbucket.org:username/repo.git"
    }
]
}

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

[RuntimeException] Failed to execute git clone --mirror "git@bitbucket.org: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 "git@bitbucket.org: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?


回答1:


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.




回答2:


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 git@bitbucket.org



回答3:


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.



来源:https://stackoverflow.com/questions/34879875/composer-permission-denied-publickey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!