Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently reinstalled my laptop and found that 'git clone' wasn't working. I was consistently receiving Permission denied (publickey). errors.

The fix is documented on GitHub's SSH issues page: use ssh-add to tell SSH about the key I want to use to authenticate on GitHub.

My question is: under the hood, what does ssh-add actually do?

I've been meaning to expand my understanding of SSH for a while, & this seems like a good excuse to start :-)

share|improve this question

2 Answers 2

up vote 8 down vote accepted

ssh-add adds private key identities (from your ~/.ssh directory) to the authentication agent (ssh-agent), so that the ssh agent can take care of the authentication for you, and you don’t have type in passwords at the terminal.

share|improve this answer
I'll be honest, this confused me for a while. I thought the ssh client always used the key in your ~/.ssh directory. Do some distros do the equivalent of ssh-add automatically? Maybe that's why I was confused? –  blong Apr 11 at 1:21

Based on this article in github, sometime on some linux distributions even after you set up everything properly this error shows up:

Agent admitted failure to sign using the key.
debug1: No more authentication methods to try.
Permission denied (publickey).

And you should run ssh-add to solve the issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.