Recently I\'ve been unable to clone or push to github, and I\'m trying to find the root cause.
This is on windows
I have cygwin + git as well as msy
This is a particularly involved problem on Windows, where it's not enough to just chmod the files correctly. You have to set up your environment.
On Windows, this worked for me:
Install cygwin.
Replace the msysgit ssh.exe with cygwin's ssh.exe.
Using cygwin bash, chmod 600 the private key file, which was "id_rsa" for me.
If it still doesn't work, go to Control Panel -> System Properties -> Advanced -> Environment Variables and add the following environment variable. Then repeat step 3.
Variable Value
CYGWIN sbmntsec
I had the same issue on Windows 10 where I tried to SSH into a Vagrant box. This seems like a bug in the old OpenSSH version. What worked for me:
(Note the ".exe" if you are using Powershell)
You might see something like:
C:\Windows\System32\OpenSSH\ssh.exe
C:\Program Files\OpenSSH\bin\ssh.exe
C:\opscode\chefdk\embedded\git\usr\bin\ssh.exe
Note that in the above example the latest OpenSSH is second in the path so it won't execute.
To change the order:
I had the same problem on Windows XP just recently. I tried to chmod 700 on my ~/.ssh/id_rsa file but it did not seem to work. When I had a look at the permissions using ls -l on the ~/.ssh/id_rsa I could see that my effective permissions still was 644.
Then I remembered that windows permissions also inherit permissions from the folders, and the folder was still open to everyone. A solution could be to set permissions for the folder as well, but I think a better way would be to tell the system to ignore inheritance for this file. This can be done using the advanced option on the security tab in the properties of the file, and unchecking "inherit from parent permissions..."
This might be helpful for others with the same problem.
I'm on XP and this allowed Git Bash to communicate w/ Github (after much frustration):
c:\cygwin\bin\cyg*
(~50 files) to c:\Program Files\Git\bin\
c:\cygwin\bin\ssh.exe
to c:\Program Files\Git\bin\
(overwriting)Create the file c:\Documents and Settings\<username>\.ssh\config
containing:
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile "/cygdrive/c/Documents and Settings/<username>/.ssh/id_rsa"
(optional) Use ssh -v git@github
to see the connection debugged.
Background: The general problem is a combination of these two:
@koby's answer doesn't work for me, so I make a little change.
cd ~/.ssh
chmod 700 id_rsa.pub
This works well for me on Mac.
After comming across the problem recently and this being one of the top google results i thought i would chip in with a simple work around documented in discussion here: http://code.google.com/p/msysgit/issues/detail?id=261#c40
Simply involves overwriting the mysys ssh.exe with your cygwin ssh.exe