permission denied (publickey) Error using git on windows 7

后端 未结 15 1935
暖寄归人
暖寄归人 2021-01-29 22:35

When I want to push to github with this command

git push origin master

I got this

Permission denied (publickey).
fatal: The rem         


        
相关标签:
15条回答
  • 2021-01-29 22:49

    Have you generated an SSH key for yourself and added it to your Github account? They have a guide for this here.

    0 讨论(0)
  • 2021-01-29 22:51

    I solved a similar problem by adding a System Environment Variable. The key was that I am pointing to the git.exe inside the cmd folder

    name: GIT
    value: C:\Program Files (x86)\Git\cmd\git.exe

    0 讨论(0)
  • 2021-01-29 22:53

    I was able to resolve this issue as follows:

    When you do:

    ssh-keygen -t rsa
    

    it prompts you to (optionally) enter a filename for saving the generated keys. Specifying a filename wasted my whole day! Next day I let it use the default filename and the problem(s) disappeared! Imagine!!

    Platform was Win7 and msysgit.

    0 讨论(0)
  • 2021-01-29 22:55

    Here is a solution to a very specific problem that has the same error signature. This was the mistake I made and it is very easy to make. Basically, instead of doing this

      git remote add origin git@github.com:myusername/myrepo.git
    

    I did this (note typo)

      git remote add origin get@github.com:myusername/myrepo.git
    

    http://www.celticwolf.com/blog/2011/02/08/git-permission-denied-publickey/

    0 讨论(0)
  • 2021-01-29 22:56

    If you have already generated the key, and it has a default name, the problem might be in the absent environment variable.

    On Windows 7 right click "My computer" and go to properties. There click on advanced properties and click the button Environment Variables. There add a user environment variable

    Name: HOME 
    Value: %USERPROFILE%
    
    0 讨论(0)
  • 2021-01-29 22:58

    Using Windows 8 to setup your ssh and Github

    1. If it says "Permission denied (publickey)" you will have to put in a passphrase for your key. Do not be tempted to just press enter...this was what worked for me...it took me five hours to realize that pressing enter made OpenSSH feel that your key was too public so that is why it is denying you from going to the next step.

    2. If it says "The authenticity of host 'github.com (203.232.175.90)' can't be established." Then you will have to go through the process shown here: [Google] (https://help.github.com/articles/error-permission-denied-publickey.)

    Go to the part that says "Verify the public key is attached to your GitHub account". You want to start with the part that says account. (I am assuming you already have an account.

    Also, you want to be in C:\RailsInstaller\Git.ssh and when I did 'dir' I noticed that I had '.', '..', 'known_hosts'. I had to get a new key by doing the following (I found this on the Github site):

    "ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. < # Enter file in which to save the key(/c/Users/you/.ssh/id_rsa): [Press enter]"

    And pay attention to the file where the key will be saved. Do not just press enter.. my one showed "(//.ssh/id_rsa)" I had to type "/.ssh/id_rsa" to make sure it was in the right directory.

    And you should be able to type ssh in the command line. If you cannot do that you will have to add it to your path.

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