I cannot fetch or pull.

 $ ssh -vT git@github.com

   debug1: Authentications that can continue: publickey
   debug1: Offering RSA public key: usersnewkey
   debug1: Authentications that can continue: publickey
   debug1: Trying private key: /Users/uname/.ssh/id_rsa
   debug1: Trying private key: /Users/uname/.ssh/id_dsa
   debug1: No more authentication methods to try.
   Permission denied (publickey).

When doing a fetch:

  $ git fetch
    git@gitlab.companyname.com's password: 
    Permission denied, please try again.

What I have tried:


I have verified that agent has key added. I have also verified that same key was added to server.

Everything WAS working fine with existing keys. I changed nothing related to Git or SSH keys. This occurred after a Mac update, and reboot, however this is a server permission denied, and it is finding the locally generated keys. What further steps can I try?

Update: A few more weird facts. This error appears for other users but they can still do a fetch without being prompted for a password. We have our own local git repo gitlab.mycompany.com So should I be running the test as what?

UPDATE: doing

         ssh -vT git@gitlab.mycompany.com 

gave different results. from ssh -vT git@github.com

For some reason, ssh -vt git@github.com ssh found the keys. However, for ssh -vt git@gitlab.mycompany.com it did not find the key!!

After adding again the same key to the agent, it went though. So now my question is why? what is there about doing ssh -vT git@gitlab.mycompany.com failing and then ssh-add mykey that made it work? Why was it finding the key when trying to connect to github but not when trying to connect to my local repo?

  • Sounds like public key not being used for this different hostname. Check config. – Huey Apr 25 '15 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.