我在代理下,我在相当长的一段时间内成功地推进。 现在我突然不能进入git了。 我已经设置了RSA密钥和代理,并仔细检查了它们,没有效果,git抛出了页面标题中显示的错误。


当前回答

问题

产生问题的步骤:git克隆git@github.com:sramachand71/test.git 这是新笔记本电脑里的第一次

错误

ssh: connect to host github.com port 22: Connection timed out
 fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

解决方案

第一次在系统中克隆时,我们需要给clone命令加双引号。

$ git clone "git@github.com:sramachand71/test.git"

我在系统中遇到这个问题,即使一切都是正确的,但最后注意到双引号是url“repository_url”必须的。第一次或新用户在系统中。

其他回答

上面的答案为我提供了解决这个问题所需的信息。在我的例子中,url错误地以ssh:///开头

要检查git配置中的url是否正确,请打开git配置文件:-

git config --local -e

检查url条目。它在开始时不应该有ssh:///。

不正确的条目:

 url = ssh:///git@github.com:username/repo.git

正确的条目:

 url = git@github.com:username/repo.git

如果您的url是正确的,那么下一步将是尝试上面建议将协议更改为http的答案。

执行:

nc -v -z <git-repository> <port>

你的输出应该是这样的:

"Connection to <git-repository> <port> port [tcp/*] succeeded!"

如果你得到:

connect to <git-repository> <port> (tcp) failed: Connection timed out

您需要编辑~/。ssh / config文件。添加如下内容:

Host example.com
Port 1234

我有这个问题2个小时,结果是从https中删除“s”,只需做:

git克隆-b <branchName> http:<projecturl>

固定它。

原因可能是防火墙修改,因为您处于网络中。(在这种情况下,他们可能会故意封锁一些端口) 再次确认这是否是原因…做

ssh -T git@github.com

这应该会超时。 如果是这种情况,使用http协议而不是ssh 只需将配置文件中的url更改为http。 方法如下:-

git config --local -e

变更分录

 url = git@github.com:username/repo.git

to

url = https://github.com/username/repo.git

好试试这个ssh -T -p 443 git@ssh.github.com而不是ssh -T git@github.com