I've generated an SSH key pair to log to my remote server. I've also added that same public key in GitHub. So from my own machine, I have SSH access to GitHub:
Hi hdodov! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
This means I can clone private repositories in my GitHub account on my local machine.
Since I use the same key to authenticate to both GitHub and my server, is it possible to use that same key to clone a repo on the server, while SSH-ed to it? If I try that, I get:
git@github.com: Permission denied (publickey).
And this makes sense, because I have no private key on the remote server - it's on my local machine. But since I've used that key connect to the server in the first place, I've proven my possession of it, so shouldn't I be able to just pull from the repo?
Yes, I can just copy my private key to the server, but transferring it over the internet sounds like a bad idea to me. Or perhaps using the same key for authentication at multiple places is the bigger issue in the first place? Should I just have separate keys?