2021年1月4日星期一

git push from a remote machine accessed through ssh gives "Permission denied (publickey)" error

To explain my situation, suppose I have PC1 and PC2.

I have a git repo in PC2, and I've set up a ssh key so I won't have to enter my credentials when doing git push. Anyways, when I git push from PC2, it works perfectly well.

Now, if I ssh from PC1 into PC2, I can edit files and git add and commit perfectly well. But, strangely, if I git push, I get an error message saying: Permission denied (publickey). fatal: Could not read from remot repository.

Please make sure you have the correct access rights and the repository exists.

If I go back and git push directly from PC2, git push works again.

Is there a way to do git push through an ssh connection from PC1?

https://stackoverflow.com/questions/65570866/git-push-from-a-remote-machine-accessed-through-ssh-gives-permission-denied-pu January 05, 2021 at 06:46AM

没有评论:

发表评论