[英]SSH error on push to an existing project Permission denied (publickey)
做了使用GitLab的所有必要步骤,这些设置是:
{my key}.pub
生成的代码,并在GitLab中添加此代码 git remote add gitlab git@gitlab.com:ridermansb/breezenhibernateproblem.git
git push -u gitlab master
我的.ssh / config
Host gitlab.com
HostName gitlab.com
IdentityFile C:\Users\Riderman\.ssh\gitlab_rsa
IdentitiesOnly yes
错误如下:
警告:永久性地将“gitlab.com,54.243.197.170”(RSA)添加到已知主机列表中。 权限被拒绝(publickey)。 致命:无法从远程存储库读取。
请确保您具有正确的访问权限并且存储库存在。
我制作了一个显示所有步骤的视频: http : //www.screenr.com/euVH
我究竟做错了什么?
看到你的截屏视频后 ,我发现你没有%HOME%\\.ssh\\config
文件。
这很重要,因为:
%HOME%\\.ssh\\id_rsa(.pub)
查找公钥/私钥%HOME%\\.ssh\\id_rsa(.pub)
git@gitlab.com:yourRepo
,使用' :
'作为分隔符),ssh可以在.ssh/config
文件中查找实际公钥/私钥的位置,使用gitlab.com
作为所述config
文件中的条目。 添加%HOME%\\.ssh\\config
:
Host gitlab.com
HostName gitlab.com
IdentityFile C:\path\to\.ssh\gitlab_rsa
IdentitiesOnly yes
和你的git push -u gitlab master
将会工作。
原来它也是关于正确设置HOME:
%HOME%
不正确。
我将变量%HOME%
配置为在本地指向%USERPROFILE%
并且它工作正常
Mysygit 确实设置了HOME ,但是如果你在git-cmd
会话之外使用git,那么你有责任正确设置HOME
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.