How to solve Permission denied (publickey) error when using Git?

后端 未结 30 1728
野性不改
野性不改 2020-11-22 08:07

I\'m on Mac Snow Leopard and I just installed git.

I just tried

git clone git@thechaw.com:cakebook.git

but that gives

相关标签:
30条回答
  • 2020-11-22 08:24

    I had to copy my ssh keys to the root folder. Google Cloud Compute Engine running Ubuntu 18.04

    sudo cp ~/.ssh/* /root/.ssh/
    
    0 讨论(0)
  • 2020-11-22 08:26

    More extensive troubleshooting and even automated fixing can be done with:

    ssh -vT git@github.com
    

    Source: https://help.github.com/articles/error-permission-denied-publickey/

    0 讨论(0)
  • 2020-11-22 08:27

    This works for me:

    ssh-add ~/.ssh/id_rsa
    
    0 讨论(0)
  • 2020-11-22 08:30

    I have just experienced this issue while setting my current project, and none of the above solution works. so i tried looking what's really happening on the debug list using the command ssh -vT git@github.com. I notice that my private key filename is not on the list. so renaming the private key filename to 'id_rsa' do the job. hope this could help.

    0 讨论(0)
  • 2020-11-22 08:30

    It worked for me.

    Your public key is saved to the id_rsa.pub;file and is the key you upload to your account. You can save this key to the clipboard by running this:

    pbcopy < ~/.ssh/id_rsa.pub

    • copy the SSH key to the clipboard, return to the web portal.
    • In the SSH Key field, paste your SSH key.
    • In the Name field, provide a name for the key.
    • save .
    0 讨论(0)
  • 2020-11-22 08:31

    Note that (at least for some projects) you must have a github account with an ssh key.

    Look at the keys listed in your authentication agent (ssh-add -l)
    (if you don't see any, add one of your existing keys with ssh-add /path/to/your/key (eg: ssh-add ~/.ssh/id_rsa))
    (if you don't have any keys, first create one. See: http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html or just google ssh-keygen)

    To verify that you have a key associated with your github account:

    Go to: https://github.com/settings/ssh

    You should see at least one key with a hash key matching one of the hashes you saw when you typed ssh-add -l just a minute ago.

    If you don't, add one, then try again.

    0 讨论(0)
提交回复
热议问题