我在代理下,我在相当长的一段时间内成功地推进。 现在我突然不能进入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”必须的。第一次或新用户在系统中。

其他回答

我在我的服务器上有这个问题,它是用常规IP和故障转移IP设置的。此时,故障转移IP没有指向服务器。我必须从/etc/netplan/01-netcfg.yaml中的服务器配置中删除故障转移IP。将故障转移IP指向该服务器也可能解决了这个问题。

执行:

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

上面的答案为我提供了解决这个问题所需的信息。在我的例子中,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的答案。

基本URL重写

Git提供了一种使用Git配置重写url的方法。只需发出以下命令:

git config --global url."https://".insteadOf git://

现在,就像变魔术一样,所有git命令都将执行git://到https://的替换

来源: git://协议被公司阻止,我怎么能绕过它?

建议检查网络连接或重新连接。