I've followed the steps in this tutorial: http://cuppster.com/2011/05/12/diy-node-js-server-on-amazon-ec2

but when I came to the step "push our local code changes to the remote repository" I got an error.

I'm running a Windows 7 pc and using putty to access my AWS EC2 instance. My Git client is msysgit.

When I try to push to ec2 I get the following error:

Pushing to ssh://ubuntu@ec2-xx-xx-xxx-xx.compute-1.amazonaws.com/home/ubuntu/repository Permission denied (publickey). fatal: The remote end hung up unexpectedly

I've tried using the almighty Google machine but I can't seem to type in the correct search terms to get an answer that works.

Any pointers that can make the push possible would be appreciated.


You need to copy your public SSH key to the server. Done by using pscp.exe and the command (in command prompt):

"c:\Program Files\Putty\pscp.exe" id_rsa.pub ubuntu@ec2-xx-xx-xxx-xx.compute-1.amazonaws.com:.ssh/authorized_keys


  • first part is the path to pscp.exe
  • 2nd part is my public part of my SSH key and
  • 3rd part is username@remote_computer:path_on_remote_computer

pscp.exe can be found at the PuTTY download page.


thanks for the answer, just adding my 2 cents,

we need to add the current aws key to login using pscp

"c:\Program Files\Putty\pscp.exe" id_rsa.pub -i "current_aws_key" ubuntu@ec2-xx-xx-xxx-xx.compute-1.amazonaws.com:.ssh/authorized_keys"

Also we need to use the new key the next time we need to putty into the linux.

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.