Public Key issues
Check that you're putting in the correct remote repository path (i.e. git@github.com:username/reponame
).
Debug the connection with ssh git@somehostname.com -T -vv
to get verbose mode.
Check the output. It will tell you what's going on. If you're still stuck, post it here and we can have a look.
ssh
will often complain if your private key or its parent directories leading to the private key have higher permissions set than they ought to.
- The key itself should be set with
chmod 0600 ~/.ssh/id_rsa
, and the ~/.ssh
directory to 0700 at most.
- The
~
and ~/..
(parent directory, often /home
on Linux and /Users
on Mac OS X) should be set to 744 at most.
Also check that the group and user permissions are set correctly on the key and its parent directories:
$ id -un && id -ug # check output of this command before using!
username
groupname
$ chown --recursive $(id -un):$(id -gn) ~
This will reset all permissions on your home directory so your current user and group own all files. This may not be what you want. See man chown
.
You may also want to check the ~/.ssh/authorized_keys
file on the remote host if you're still having trouble. Its permissions are also a point of failure.
Repairing OSX directory permissions
@AlexanderSupertramp, I said the permissions should be 744
'at most,' yes, referring to the requirements for SSH only. But I did not suggest that you should chmod the /home
directory to that number. Each operating system has its own requirements for directory permissions, and I could only provide generic instructions since you didn't provide much information about your system. In any case, I am terribly sorry that my answer was not clear.
It is possible that your mac is failing to boot because 744
is too liberal. But I cannot be sure. To resolve this you may want to pay a visit to the Genius Bar at an Apple Store or contact an authorized repair technician. You may also be able to fix the directory permissions automatically using built-in tools as follow:
- Boot into single-user mode by pressing
Command+S
at the same time as the power button to turn on your mac, as explained in this article.
- Launch the OSX Disk Utility from the menu bar, and then use the repair permissions tool as described in this Apple KB