From man ssh-add:
ssh-add adds private key identities to the authentication agent,
ssh-agent(1). When run without arguments, it adds the files
~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/identity.[...]
Identity files should not be readable by anyone but the user. Note that
ssh-add ignores identity files if they are accessible by others.
So, because of The agent has no identities. error, you probably don't have those files or maybe those files are accessible by others. You can check these using the following command:
ls -l ~/.ssh
Also, after you run ssh-add command, run echo $? to see the error status of the previous command. If exit status returned 0, the command was executed successfully. If exit status returned a non-zero value, the command failed to execute.
See man ssh-add for more info.
ssh-addwas 1 but not 0. there is obviously some problem with my permissions since the files are not created. Any idea how I could fix this?the directory
– bjorgvin Oct 23 '13 at 15:49~/.sshexists (is empty) but it does not show up when I dols -lssh-keygen -q -t rsa -N 'password' -f ~/.ssh/id_rsaso man ssh-keygen helped, thanks. – bjorgvin Oct 24 '13 at 10:15ssh-addafter entering passphrase, (it was failing according to$?returing 1. I tried tochmod 600 ~/.ssh/id_rsa*with no luck. I generated a new key from scratch withssh-keygenand then it worked. Sad but at least it's ok now (The failing key was generated usingssh-keygen -t rsa -b 4096 -C "your_email@example.com", I only ranssh-keygeninstead this time). – GabLeRoux Jun 24 '15 at 09:11cd ~/.ssh && ls -lahto see read/write permissions in the .ssh folder, change all key(s) withchmod 400 myKeythenssh-add **ABSOLUTE**pathToKeyif you don't add the ABSOLUTE path, it won't work. Then, test it withssh -vT git@github.com– jungledev Nov 22 '16 at 22:19