简体   繁体   中英

Can't do git commands while remoting into a vps via source control in visual studio code

I realize the title is a bit of a mouthful but I'm not entirely sure how else to describe my issue. I've remoted into a server (via VS Code's RemoteSSH extension) that I have hosted online; while I was trying to connect to the server I had to enter an ssh passphrase as per usual. I'm trying to update a repository via Github that I have cloned on the remote machine, but whenever I try to use the pull/push options within the Source Control extension, I get a git@github.com: Permission denied (publickey). message. If I go into the terminal window within VS Code I can do git pull normally; it asks me to enter my passphrase, and gives the appropriate response:

name@server:~/test-repo$ git pull
Enter passphrase for key '/home/name/.ssh/github_rsa': 
Already up to date.

I'm not sure if there's something I'm missing here. I will say that my key is not named the default id_rsa file - but I'm not sure if that is the cause of this issue? I have an ssh config file on the server and it looks like the Terminal is reading that properly, but why isn't the Source Control extension working the same way?

You can set GIT_SSH_COMMAND to ssh -Tv

That way, you will see the difference between the SSH session through the remote SSH extension and the terminal Windows.

If the key is not named id_rsa , look for a ~/.ssh/config file, which would include the actual private key path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM