由于权限问题,使用ssh的git克隆在Windows中失败 [英] git clone using ssh failed in Windows due to permission issue

查看:943
本文介绍了由于权限问题,使用ssh的git克隆在Windows中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 /home/myuser/.git/project.git 的服务器中创建了一个新的GIT存储库。
我从找到了git的ssh密钥C:\ Users \Toshiba\.ssh\github_rsa.pub &附加服务器的 authorized_keys 文件。



当我尝试使用ssh做git clone时, p>


$ git clone ssh://myuser@mysite.net:2888 / home / myuser / .git / project.git

$克隆到'项目'中
权限被拒绝(publickey,gssapi-keyex,gssapi-与-MIC)。
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

您可以帮我解决这个问题。

解决方案

如果您的公钥/私钥没有标准名称 C:\Users\Toshiba\.ssh\id_rsa(。酒馆),但 C:\Users\Toshiba\.ssh\github_rsa.pub ,那么你就需要一个ssh配置文件

 主机mysite 
主机名mysite.net
用户myuser
端口2888
IdentityFile C:\ Users \Toshiba\.ssh\github_rsa.pub

这可以让你要做

  git clone mysite:/home/myuser/.git/project.git 
ssh -Tvvv mysite
进行测试,然后 $ b> ssh mysite ls 。



确保环境变量%HOME%被定义为 C:\ Users \Toshiba



您在推送到现有项目的SSH错误Permission denied(publickey)


I have created a new GIT repository in my server at /home/myuser/.git/project.git. I found ssh key for git from C:\Users\Toshiba\.ssh\github_rsa.pub & appended with server's authorized_keys file.

when i try to do git clone using ssh it fails as below.

$ git clone ssh://myuser@mysite.net:2888/home/myuser/.git/project.git

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.

Could you please help me in resolving this issue.

解决方案

If your public/private key doesn't have the standard name C:\Users\Toshiba\.ssh\id_rsa(.pub), but C:\Users\Toshiba\.ssh\github_rsa.pub, then you need an ssh config file

Host mysite
   Hostname mysite.net
   User myuser
   Port 2888
   IdentityFile C:\Users\Toshiba\.ssh\github_rsa.pub 

That would allow you to do

git clone mysite:/home/myuser/.git/project.git

Test it first wih ssh -Tvvv mysite, and then ssh mysite ls.

Make sure the environment variable %HOME% is defined to C:\Users\Toshiba

You have another example in "SSH error on push to an existing project Permission denied (publickey)"

这篇关于由于权限问题,使用ssh的git克隆在Windows中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆