Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a setup where I can ssh into my remote server (ie a Google Compute instance) from my local machine. I used to be able to clone, push, and pull from a repository on my remote instance without adding any keys to my remote instance, nor adding any new keys to my repository online (just the public key from my local machine). I believe the remote instance was using the keys from my local machine to authenticate my Git pushes and pulls.

However, the system broke when I reinstalled the OS on my local machine. Now I when I try to connect with the Github server from my remote instance, I get the following:

Cannot clone:

[lucas@ecoinstance]~/node$ git clone git@github.com:lucasExample/test.git test
Cloning into 'test'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Cannot push:

[lucas@ecoinstance]~/node/nodetest1$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
[lucas@ecoinstance]~/node/nodetest1$ git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Additional info:

[lucas@ecoinstance]~/node/nodetest1$ ssh-add -l
Could not open a connection to your authentication agent.

[lucas@ecoinstance]~/.ssh$ ls
authorized_keys  known_hosts

As you can see, I have no keys on my remote instance. I have never had keys on the remote, and it would push and pull just fine until I re-installed my local OS.

I can still clone, push, and pull on my local machine, it is just my remote machine that cannot get authentication. My local OS is Ubuntu 14.04 and my remote OS is Debian Wheezy.

Any suggestions would be great. I am not sure how to search for this concept where I can authenticate from a remote instance via my local machine, so any reference are appreciated as well.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It sounds like you probably had ssh key forwarding setup before you reloaded your local machine. This would allow the remote machine to use the key that you have locally.

On your local machine edit ~/.ssh/config and add

Host remoteHost
    ForwardAgent yes

Github has a more detailed tutorial if you run into any issues

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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