我在服务器/home/myuser/.git/project.git
上创建了一个新的GIT存储库。
我从C:\Users\Toshiba\.ssh\github_rsa.pub
找到了git的ssh密钥,并附加了服务器的authorized_keys
文件。
当我尝试使用ssh进行git clone时,失败如下。
Cloning into 'project'...
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
您能帮我解决这个问题吗?
最佳答案
如果您的公钥/私钥的标准名称不是C:\Users\Toshiba\.ssh\id_rsa(.pub)
,而是C:\Users\Toshiba\.ssh\github_rsa.pub
,那么您需要一个ssh配置文件
Host mysite
Hostname mysite.net
User myuser
Port 2888
IdentityFile C:\Users\Toshiba\.ssh\github_rsa.pub
那会让你做
git clone mysite:/home/myuser/.git/project.git
首先用
ssh -Tvvv mysite
测试,然后再测试ssh mysite ls
。确保将环境变量
%HOME%
定义为C:\Users\Toshiba
您在“SSH error on push to an existing project Permission denied (publickey)”中还有另一个示例
关于linux - 由于权限问题,Windows中使用ssh的git clone失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25855342/