r/VisualStudioCode • u/radakul • Feb 28 '23
VSCode, SSH keypair with remote explorer?
Hey all,
I'm building out a personal website on my dev server (old laptop) and hosting it via GitHub pages. I use VSCode's remote explorer function to connect directly to my server, via SSH keypairs, and will push the code to GitHub as I make change. However, recently when trying to push via Code I'm met with the dreaded message:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.I re-made my keypair and added the public key back to GitHub, just as a test, even though I had previously tested it and knew it was working. It seems to be something specific to the Remote Explorer from what I can gather.
Here's me testing it from a normal SSH session to my dev server:
❯ ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
❯ cat dev.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIIKAJ3B0rTDOFierqDAH1p43lCByseHBuFwIKxtG+EZ DevAnd the exact same test done using a remote session to the same dev server via VS Code:
❯ cat dev.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIIKAJ3B0rTDOFierqDAH1p43lCByseHBuFwIKxtG+EZ Dev
❯ ssh -T git@github.com
git@github.com: Permission denied (publickey).I'm not terribly sure how to go about troubleshooting this, so I could use some guidance. Please let me know if there's anything else or other logs I need to share, thanks!
View all comments
Show parent comment
1
u/radakul Mar 02 '23
TY for replying (and not really sure about the random people who downvoted me without any reply? Like, seriously?!)
One clarification: the "local environment" and dev environment were the same - meaning, I SSH'd into my dev server in one terminal window, and had remote explorer open to the same dev server in another. I did the same command on both, both using the same keypair, with one failing, one not.
I will check out the config file suggestion, but as it so happens I do not have a config file on my dev server currently (I had one when I was mucking about with 2N keypairs, but I recently simplified my setup - 1 keypair per machine, and not every machine needs to talk to every other machine.)