I have two machines (a. Ubuntu machine b. Windows machine)

I have cloned code from a github repo in the Ubuntu machine and I am able to run git commands if I login into the Ubuntu machine (directly)

But if I login into the Ubuntu machine (using the same userid) via a Windows machine (using putty), then it fails to pull code on a git pull. It results in a permission denied error

Permission denied (publickey). fatal: The remote end hung up unexpectedly

Why I am not able to pull code if I login from my Windows machine?

  • Are you using the same user to login via SSH from windows , I mean same user you used to login directly in your ubuntu
    – Aravind.HU
    Oct 15 '12 at 6:49
  • yes, am using the same user credentials to login into the Ubuntu machine.
    – Joshua
    Oct 15 '12 at 6:57
  • Is your $HOME defined properly once logged through your putty session? It will be needed for getting to your ssh public/private keys.
    – VonC
    Oct 15 '12 at 7:03
  • are you logging in via the GUI when directly logging in on the Ubuntu machine? Oct 15 '12 at 10:16

I suspect your ssh private key is being unlocked by the ssh-agent setup by your GUI login on the Ubuntu machine, whereas your putty/ssh connection isn't setting up an ssh-agent correctly to get access to your private key.

You could try running eval $(ssh-agent) and ssh-add to setup an agent on your ssh connection.

I'm surprised that git isn't asking for your password in this case though?

Your Answer

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

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