I'm setting up git on my new Windows 7 machine and I'm hitting a roadblock when it comes to getting github to acknowledge my ssh key. I am doing things a little different from the standard script in that I would rather not use cygwin and prefer to use my powershell p开发者_开发百科rompt. The following is what I did:
- I installed msysgit (portable).
- I went to C:\program files\git\bin and used ssh-keygen to generate a public/private ssh keypair which I put in c:\Temp
- I then created a directory named .ssh\ in c:\Users\myusername\ (on windows 7)
- I moved both the files generated by the ssh-keygen (id_rsa and id_rsa.pub) into the .ssh directory
- I went to my account on github, created a new public key, copy-pasted the contents of id_rsa.pub into it and saved
- I now go to my powershell prompt, set-alias git 'C:\program files\git\bin\git.exe'
I try to now do a clone git@github.com:togakangaroo/ps-profile.git which rejects my authentication:
Permission denied (publickey). fatal: The remote end hung up unexpectedly
Past experience says that this means git is not recognizing my key. What steps am I missing?
I have a feeling that I need to somehow configure git so that it knows where my ssh keys are (though it would seem it should look there automatically) but I don't know how to do that.
Another possible clue is that when I try to run git config --global user.name "George Mauer" I get an error
fatal: $HOME not set
I did however set up a HOME environment user variable with the value %HOMEDRIVE%%HOMEPATH%
I had the same problem. I accidently added the wrong directory to the path.
After I changed that from *\Git\bin\
to *\Git\cmd\
everything worked.
git.cmd
sets up the environment variables.
My solution to the
"Could not open a connection to your authentication agent."
error on Windows 7 was to first run ssh -v git@github.com
in the git Bash console to find out what sort of public key file Github was looking for. The filename I saw was id_rsa
.
Then, I viewed the c:\users\username\.ssh
folder in Windows Explorer and noticed that while there was no id_rsa
file, there was github_rsa
and github_rsa.pub
.
Copying these files in the c:\users\username\.ssh
folder and renaming the copies to id_rsa
and id_rsa.pub
respectively solved the issue for me.
I was then able to push local commits to the repository on Github.
The command you're looking for is:
ssh-add C:\path\to\key
First, you may want to find out where ssh is currently looking for your keys, by running ssh -v git@github.com
I have same problem, It's fixed by putting your id_rsa
* file at C:\Program Files\Git\.ssh
folder
I had this problem on Windows 7. Once I addressed the missing HOME environment variable by pointing HOME to c/Users/wherever the problem was fixed.
More here: http://code.google.com/p/msysgit/issues/detail?id=482
I had the same problem with PowerShell for ~3 hours.
Simply set your HOME variable to be
C:\Users\Your Username
and restart PowerShell. Then ensure all your keys and all match.
I had the problem, but it was caused by Internet Explorer 8.0.7600 having a JavaScript error when trying to perform the "add key" button functionality on my GitHub login "Account Settings" page "SSH Public Keys". This meant that the add key failed, and the key was not listed on the page of public keys above the link "Add another key". I switched to Firefox.
Unless it's completely necessary, I would recommend not using the portable mysysgit. This worked almost out-of-the-box for me using the normal mysysgit installed.
However, I did recently set this up on a new Windows machine and ran into a similar issue. This was fixed by converting my plink SSH key into an OpenSSH-compatible key, and moving this into my personal .ssh folder. After that, it worked a charm!
If interested, see here
精彩评论