Github SSH Key not working for command line but is working for Mac GUI Tool from Github – this is quite common situation and here is very easy way to fix it. Github has official guide for Github SSH Key not working for command line, but actually that is not very practical in all cases. They have used an one user, one repository (that is Github) specific guide.
Github SSH Key not working for command line : Why it Happens
Github SSH Key not working for command line but nicely for command line tool, happens due to actually wrong setup of the Github App or may be they deliberately created the App in an way to avoid UNIX’s security which actually will create the installation difficult or may be they thought that who will use command line tool will not use the GUI tool.
It happens when there are lot of other repositories on various servers already added before adding the SSH keys of Github on your OS X or may be that GUI tool. Actually there is not much meaning to dissect the origin problem from so much depth. Understand one thing, that normally OS X will allow id_rsa SSH key but the GUI tool uses the named key. You can manually add that key in Github Interface for CLI or you can use symlink or add another key. We will use the last way.
Recommended Reading :
- Secure Shell or SSH (its not about Key itself)
- Managing Multiple SSH Keys Through Command Line (for OSX, in Linux it will work in kind of same way)
- Handy Guide to PuTTY (This is a SSH/Telnet client for Windows users who has not upgraded their OS to Linux)
Github SSH Key Not Working For Command Line : Troubleshooting
We are taking that you have some idea how to add, manage SSH keys. Notice the screenshot :
When you are running this command :
ssh -vT email@example.com
You are getting this :
debug1: No more authentication methods to try.Permission denied (publickey).
Run this command :
eval [crayon-59019707e8b96538186275 inline="true" ]ssh-agent[/crayon]
It should return an Agent PID. If it does not work, there is definite gross issue and work from the beginning to generate RSA Key in proper hierarchy for better management. Now Add the Key :
It will give the return :
Identity added: /Users/username/.ssh/id_rsa (/Users/username/.ssh/id_rsa)
Now go back to what Github actually said in the guide (copy paste the url) :
That is, running :
Run the command :
pbcopy < ~/.ssh/id_rsa.pub
It will copy the big key in clipboard. Your work is to go to the Github’s webcontrol panel and adding another new key. Ultimately you will get two set of keys :
Obviously you have to paste the clip board in that field to add key by hitting command + V from keyboard. The reason to add two separate keys is for finer independent control and specific tracking.