无法推送到远程存储库(git)

时间:2021-02-09 16:24:00

I don't know if it's just me, but I find the process of interacting with remote repositories of Git via command line utterly frustrating. I have generated my own SSH key, added it to my GitLab account. And I have the same key saved, just checked to be sure. And yet, if I try to:

我不知道它是否只是我,但我发现通过命令行与Git的远程存储库进行交互的过程非常令人沮丧。我已经生成了自己的SSH密钥,将其添加到我的GitLab帐户。我保存了相同的密钥,只是检查确定。然而,如果我尝试:

git push origin master

of course being in the proper git folder, the only thing I get is the infamous:

当然是在正确的git文件夹中,我唯一得到的是臭名昭着:

Permission denied (publickey). 

Any ideas?

1 个解决方案

#1


Make sure you launch your Git with <path\to\git1.9.4>\git-cmd.bat: it will define HOME to %USERPROFILE%.

确保使用 \ git-cmd.bat启动Git:它将HOME定义为%USERPROFILE%。

Then make sure your public (id_rsa.pub) and private (id_rsa) ssh keys are in %HOME\.ssh

然后确保您的public(id_rsa.pub)和private(id_rsa)ssh键位于%HOME \ .ssh中

A ssh -Tv git@<gitlabserver> should then work (unless your private key is passphrase protected).

然后应该使用ssh -Tv git @ (除非您的私钥受密码保护)。

#1


Make sure you launch your Git with <path\to\git1.9.4>\git-cmd.bat: it will define HOME to %USERPROFILE%.

确保使用 \ git-cmd.bat启动Git:它将HOME定义为%USERPROFILE%。

Then make sure your public (id_rsa.pub) and private (id_rsa) ssh keys are in %HOME\.ssh

然后确保您的public(id_rsa.pub)和private(id_rsa)ssh键位于%HOME \ .ssh中

A ssh -Tv git@<gitlabserver> should then work (unless your private key is passphrase protected).

然后应该使用ssh -Tv git @ (除非您的私钥受密码保护)。