ssh克隆不克隆repo在git [英] ssh clone not cloning repo in git
问题描述
我想使用ssh克隆另一个人的仓库。为此,我做了以下事情:
I want to clone a repo of another person using ssh. For this I did following things:
- 在本地计算机上生成了ssh密钥。
- 通过运行
ssh -T git@github.com $测试了是否添加了该密钥c $ c>其中输出:
您好用的用户名!您已成功验证,但GitHub不提供shell访问。
- Ran
git clone git@github.com:repo / repo .git
。
- Generated an ssh key in local machine.
- Added the key to the user's account from which the repo has to be cloned.
- Tested whether the key was added by running
ssh -T git@github.com
which outputs :Hi username! You've successfully authenticated, but GitHub does not provide shell access.
- Ran
git clone git@github.com:repo/repo.git
.
最后一步将克隆输出为'Foldername'...我可以看到该文件夹已创建,但文件夹中不存在任何文件。我离开了1小时,但没有什么被复制,我也检查网,但它的工作罚款。
我在Windows上使用cygwin来克隆仓库。
The last step outputs Cloning into 'Foldername'... and I can see that the folder is created but no files are present in the folder. I left it for 1 hour but nothing was copied and I also checked the net but its working fine. I am using cygwin on windows to clone the repo.
我做错了什么?
推荐答案
我已经解决了这个问题。
I have solved the problem. The problem was occurring because of different home directories of Git bash and cygwin.
当我在cygwin终端中生成ssh密钥时,密钥是添加到 cygwin的.ssh文件夹,它是 C:\cygwin\home\windows\.ssh
,当我运行命令 ssh -T git@github.com
它使用cygwin的.ssh目录中的ssh密钥验证了我。
When I generated the ssh key in my cygwin terminal the key was added to cygwin's .ssh folder which was C:\cygwin\home\windows\.ssh
and when I ran the command ssh -T git@github.com
it authenticated me using the ssh key which was in cygwin's .ssh directory.
但是当我运行命令 git clone git@github.com:repo / repo.git
时,使用 git bash的主目录位于 C:\Users\windows\.ssh
中。我将cygwin的.ssh文件夹中的关键字复制到这个文件夹中,一切工作正常。
But when I ran the command git clone git@github.com:repo/repo.git
, the key in git bash's home directory was used which was in C:\Users\windows\.ssh
. I copied the key present in cygwin's .ssh folder into this folder and everything worked fine.
但是奇怪的是git clone git .com:repo / repo.git 命令没有抛出任何错误,而是刚刚挂起。
However the weird thing is the git clone git@github.com:repo/repo.git
command didn't threw any error but instead just hanged.
这篇关于ssh克隆不克隆repo在git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!