Reputation: 456
I am having some issues with using git (github) on a remotely accessed machine. I am logging in from home into my work computer via ssh e.g.
me@home$ ssh me@work
after which I try to do a pull or push request to github on my work computer via home e.g.
me@workViaHome$ git pull origin branch
after which I receive the error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have tried loading the ssh key from my work computer using:
me@workViaHome$ eval "$(ssh-agent -s)"
me@workViaHome$ ssh-add ~/.ssh/id_rsa
but still no luck. When I am physically at my work computer I can issue requests to github without any issues; so it seems the issue with with the status of my ssh-keys due to my ssh session.
Thanks for any help!
Upvotes: 4
Views: 936
Reputation: 25926
SSH is using the default keys if it is not specified otherwise in configuration or if the ssh-agent
is not providing any other key.
If you are using a key in nonstandard location, that you have added in your gnome-keyring
, you could notice this behavior, because gnome-keying
starts only for the graphical sessions, but not for ssh
sessions.
Certainly, you can resolve this by properly configuring this key in ~/.ssh/config
on the work computer. Just add
Host github.com
IdentityFile ~/.ssh/path_to_key
IdentitiesOnly yes
Upvotes: 2