简体   繁体   English

ssh clone不克隆git仓库

[英]ssh clone not cloning repo in git

I want to clone a repo of another person using ssh. 我想使用ssh克隆另一个人的仓库。 For this I did following things: 为此,我做了以下事情:

  • Generated an ssh key in local machine. 在本地计算机上生成了一个ssh密钥。
  • 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. 测试了是否通过运行ssh -T git@github.com添加了密钥,该命令输出: Hi username! You've successfully authenticated, but GitHub does not provide shell access. Hi username! You've successfully authenticated, but GitHub does not provide shell access.
  • Ran git clone git@github.com:repo/repo.git . git clone git@github.com:repo/repo.git

The last step outputs Cloning into 'Foldername'... and I can see that the folder is created but no files are present in the folder. 最后一步输出Cloning into'Foldername'...,我可以看到该文件夹​​已创建,但该文件夹中没有文件。 I left it for 1 hour but nothing was copied and I also checked the net but its working fine. 我将其放置了1个小时,但没有复制任何内容,我还检查了网络,但工作正常。 I am using cygwin on windows to clone the repo. 我在Windows上使用cygwin来克隆存储库。

What am I doing wrong? 我究竟做错了什么?

I have solved the problem. 我已经解决了问题。 The problem was occurring because of different home directories of Git bash and cygwin . 发生此问题是由于Git bash和cygwin的主目录不同

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. 当我在cygwin终端中生成ssh密钥时,该密钥已添加到cygwin的.ssh文件夹中 ,该文件夹C:\\cygwin\\home\\windows\\.ssh ,当我运行命令ssh -T git@github.com它使用cygwin的.ssh目录中的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 . 但是,当我运行命令git clone git@github.com:repo/repo.git ,使用了git bash主目录中的密钥,该密钥位于C:\\Users\\windows\\.ssh I copied the key present in cygwin's .ssh folder into this folder and everything worked fine. 我将cygwin的.ssh文件夹中存在的密钥复制到此文件夹中,一切正常。

However the weird thing is the git clone git@github.com:repo/repo.git command didn't threw any error but instead just hanged. 但是奇怪的是git clone git@github.com:repo/repo.git命令并没有抛出任何错误,而是被挂起了。

I can't fork it in my account as then it will be public. 我无法将其分叉到我的帐户中,因为它将公开。

Nope: a private repo that you fork... would remain private! 否:您分叉的私人仓库...将保持私密!
This is detailed in " If I fork someone else's private Github repo into my account, is it going to appear in my account as a public repo? ". 如果我将其他人的私有Github回购分叉到我的帐户中,它将作为我的公共回购出现在我的帐户中吗? ”中有详细说明。

So if cloning from your account works, forking the repo of your colleague could be a good solution. 因此,如果从您的帐户进行克隆是可行的,那么分叉同事的仓库可能是一个很好的解决方案。

GitHub is currently experiencing downtime (see also https://status.github.com/ ), so that might be your issue: GitHub当前正在停机 (另请参见https://status.github.com/ ),因此这可能是您的问题:

We're investigating an increase in unicorns. 我们正在调查独角兽数量的增长。

That's a humorous way to say that people are getting 404s on the pages on GitHub, because their 404 page has a unicorn on it: 这是一种幽默的说法,人们在GitHub的页面上获取404,因为他们的404页面上有一个独角兽:

在此处输入图片说明

It's not uncommon for GitHub to experience minor/major outages , probably because it's such a popular service. GitHub遇到次要/主要中断的情况并不少见 ,可能是因为它是一项如此受欢迎的服务。 They also experience the occasional DDoS attack : 他们还会遇到偶发的DDoS攻击

We're currently experiencing a large DDoS attack. 我们目前正遭受大型DDoS攻击。 The site is experiencing major ... See more at https://status.github.com/ . 该网站正在经历主要...请访问https://status.github.com/了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM