How to set up Git on remote instance using keys from local machine?
- by Lucas
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 [email protected]: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.