Skip to content

Permission denied (publickey) Error using git

February 1, 2013

If you are using Windows 7 and you get the following message when using SSH on the github console: –

“Permission denied (publickey)”This usually happens when you are using ssh on the github bash or powershell with a command like

ssh -T

This problem is that ssh agent is NOT running in the background and if ssh-add says it couldn’t connect to your authentication agent, it simply means you do not have an ssh-agent running, as stated by the following statement from stackoverflow Try ssh-add, you need ssh-agent to be running and holding your private key.

You can test that it works on port 433 from ssh -T -p 443, and this should show:-

Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.

A quick fix to get around this that the console will recognise this private key to be passed to SSH. Inside the .ssh folder, the file config can be looked up. If the file isn’t created, create it now.

Inside the contents of the file, it need the contents: –

IdentityFile ~/.ssh/id_rsa
  Port 443

The magic is the first line, this simply points to the file id_rsa for the private key ssh gen code.

Now try the ssh command, and it should now work!


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: