GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly

前端 未结 23 1555
情深已故
情深已故 2020-11-28 01:09

I have followed these instructions below to upload a project.

Global setup:

 Download and install Git
  git config --global user.name \"Your Name\"
         


        
相关标签:
23条回答
  • 2020-11-28 01:40

    A quick way to fix this if you're using a Mac is to sign out of the OSX app and log back in.

    0 讨论(0)
  • 2020-11-28 01:41

    Adding public key is the solution.For generating ssh keys: https://help.github.com/articles/generating-ssh-keys has step by step instructions.

    However, the problem can persist if key is not generated in the correct way. I found this to be a useful link too: https://help.github.com/articles/error-permission-denied-publickey

    In my case the problem was that I was generating the ssh-key without using sudo but when using git commands I needed to use sudo. This comment in the above link "If you generate SSH keys without sudo, then when you try to use a command like sudo git push, you won't be using the SSH key you generated." helped me.

    So, the solution was that I had to use sudo with both key generating commands and git commands. Or for others, when they don't need sudo anywhere, do not use it in any of the two steps. (key generating and git commands).

    0 讨论(0)
  • 2020-11-28 01:41

    I tried the solutions mentioned but still failed. I found the solution that finally worked for me here - removing then re-adding the remote link

    0 讨论(0)
  • 2020-11-28 01:44

    Type the following command using your username and repository name:

    git clone https://github.com/{user name}/{repo name}
    

    in Ubuntu this works perfectly.

    0 讨论(0)
  • 2020-11-28 01:45

    You need to set up SSH keys.

    This GitHub page explains how to generate keys.

    If you have an existing key, you copy $HOME/.ssh/id_rsa.pub and paste it into the GitHub SSH settings page.

    0 讨论(0)
  • 2020-11-28 01:48

    I had to add my public key to github. https://help.github.com/articles/generating-ssh-keys

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