Github permission denied: ssh add agent has no identifiers

This is my first github access, and I'm not sure about using the console. I am on a Macbook (using Bash). When I try to access github, I get the following:

git clone git@github.com:dhulihan/league-of-legends-data-scraper.git Cloning into 'league-of-legends-data-scraper'... Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

I tried following the instructions on the Github page about Permission denied. When I use ssh -vT git @ github.com, I get the following:

 OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: Connecting to github.com [192.30.252.129] port 22. debug1: Connection established. debug1: identity file /Users/XXXX/.ssh/id_rsa type -1 debug1: identity file /Users/XXXX/.ssh/id_rsa-cert type -1 debug1: identity file /Users/XXXX/.ssh/id_dsa type -1 debug1: identity file /Users/XXXX/.ssh/id_dsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 debug1: Remote protocol version 2.0, remote software version libssh-0.6.0 debug1: no match: libssh-0.6.0 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-sha1 none debug1: kex: client->server aes128-ctr hmac-sha1 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /Users/XXXX/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /Users/XXXX/.ssh/id_rsa debug1: Trying private key: /Users/XXXX/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). 

Then eval "$ (ssh-agent -s)" returns "Agent pid 2314" However, ssh-add -l returns "Agent has no identifiers."

And this is where I am stuck. I tried searching for this problem and searching here on SO. I tried to access the files in the ssh directory, but they are not there. Just a folder called Knownusers.

Can someone help me with this problem?

+107
github bash ssh public-key permission-denied
Oct 22 '14 at 11:02
source share
11 answers

More on this at.

In conclusion, when ssh-add -l returns The agent has no identities , this means that the keys used by ssh (are stored in files such as ~ / .ssh / id_rsa, ~ / .ssh / id_dsa, etc.) either absent, they are not known to the authentication agent ( ssh-agent ), or their permissions are set incorrectly (for example, for recording in the world).

If your keys are missing (i.e. you did not generate any keys), use "ssh-keygen" (for example, ssh-keygen -t rsa ) to create them, then use ssh-add to add them.

If the keys exist but ssh-agent not known (for example, they can be in a non-standard folder), use their 'ssh-add' (for example, ssh-add /path/to/my-ssh-folder/id_rsa ).

See this answer if you are having problems with ssh-add or ssh-agent .

+140
Feb 11 '15 at 0:43
source share
β€” -

try the following:

 ssh-add ~/.ssh/id_rsa 

worked for me

+89
Apr 13 '16 at 11:36
source share

ANSWER 2019 on macOS Sierra and High Sierra and Catalina

PS: most of the other answers will help you create a new ssh key ... but you don't need to do this :)

As described in detail at https://openradar.appspot.com/27348363 , macOS / OS X prior to Yosemite was used to remember the SSH keys added by the ssh-add -K <key> command

So, here are 4 steps that I had to take in order for it to work:

1: ssh-add ~/.ssh/PATH_TO_YOUR_SSH_PRIVATE_KEY (eg ~/.ssh/id_rsa)

2: Add the following to ~/.ssh/config

 Host * AddKeysToAgent yes UseKeychain yes IdentityFile PATH_TO_YOUR_SSH_PRIVATE_KEY (eg ~/.ssh/id_rsa) 

3: be sure to delete all gitconfig entries using the osxkeychain helper:

  https://github.com/gregory/dotfiles/commit/e38000527fb1a82b577f2dcf685aeefd3b78a609#diff-6cb0f77b38346e0fed47293bdc6430c6L48 

4: restart the terminal for it to take effect.

+26
Jul 18 '17 at 20:59 on
source share

I was spotted at the same time on the same issue that I eventually resolved.

My problem : I could not do any push. I could check and see my remote (using git remote -v ), but when I ran git push origin master , it returned: Permission denied (publickey). fatal: Could not read from remote repository. Permission denied (publickey). fatal: Could not read from remote repository. so.

As I decided:

Then the push command eventually worked!

Hope this helps! Good luck everyone.

+10
Sep 20 '16 at 19:49
source share

Run the following commands:

 ssh-keygen -t rsa ssh-add /Users/*yourUserNameHere*/.ssh/id_rsa** pbcopy < ~/.ssh/id_rsa.pub** 

Go to your Github account: https://github.com/settings/profile

1) Click: SSH and GPG keys

2) The new SSH key and passed it there

3) Add SSH key

Done!

+7
Oct. 27 '17 at 18:43 on
source share

first of all you need to enter your ssh directory
for this type, the following command in your terminal in the poppy or what you use in the window

 cd ~/.ssh 

now it is in ssh here you can find all your ssh keys / files related to your projects. now enter the following command to show you if any ssh key is available

 ls 

this will show you all the available ssh, in my case there were two of them now you will need to start the agent to add ssh to it. For this type, the following command

 eval "$(ssh-agent -s)" 

now last but not least: you add ssh to this type of agent the following command

 ssh-add ~/.ssh/your-ssh 

replace

replace your-ssh with your ssh file name from which you received the second stage form ls command

+5
Dec 03 '17 at 16:32
source share

This can cause for any new terminal, the agent identifier is different. You need to add the private key for the agent

 $ ssh-add <path to your private key> 
+5
Jan 22 '18 at 21:10
source share

Another element that I realized is that usually the .ssh folder is created in your root folder on Mac OS X / Users /. If you try to use ssh -vT git@github.com from another folder, this will give you an error, even if you added the correct key.

You need to add the key again (ssh-add 'the correct path to id_rsa') from the current folder for successful authentication (provided that you have already uploaded the key to your profile in Git)

+1
Feb 21 '18 at 3:51
source share

After long attempts, I was finally able to solve this problem on Windows. For me, the variable User env GIT_SSH was set to point to

"C: \ Program Files (x86) \ WinScp \ PuTTY \ plink.exe"

which was installed with WinScp. I changed the indication to use ssh.exe by default, which comes with git-scm "C: \ Program Files \ Git \ usr \ bin \ ssh.exe"

0
Mar 11 '18 at 7:58
source share

Steps for BitBucket:

if you do not want to create a new key, skip ssh-keygen

 ssh-keygen -t rsa 

Copy the public key to the clipboard:

 clip < ~/.ssh/id_rsa.pub 

Log into Bit Bucket: go to "View Profile" β†’ "Settings" β†’ "SSH Keys" (on the "Security" tab). Click Add Key, paste the key in the field and add a descriptive title.

Return to Git Bash:

 ssh-add -l 

You should receive:

 2048 SHA256:5zabdekjjjaalajafjLIa3Gl/k832A /c/Users/username/.ssh/id_rsa (RSA) 

Now: git pull should work

0
Dec 12 '18 at 10:30
source share

This worked for me:
chmod 700.ssh chmod 600.ssh/id_rsa chmod 644.ssh/id_rsa.pub

Then enter this: ssh-add ~/.ssh/id_rsa

0
Jan 27 '19 at 21:22
source share



All Articles