[英]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.