Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让git克隆与ssh一起工作?_Git_Github_Ssh - Fatal编程技术网

如何让git克隆与ssh一起工作?

如何让git克隆与ssh一起工作?,git,github,ssh,Git,Github,Ssh,我是一个试图用ssh克隆我的githubrepo的gitnewbie。我遵循以下步骤: 在代理环境中工作,所以直觉认为这可能与此有关。当我离开时:git clonegit@github.com:myuser/myrepo.git,我收到以下错误: ssh: connect to host github.com port 22: Connection timed out 如何修复此错误?您可以用修复任何ssh问题的方法来修复此错误。从等式中删除Git,然后尝试使用ssh登录。如果它起作用,你应

我是一个试图用ssh克隆我的githubrepo的gitnewbie。我遵循以下步骤:

在代理环境中工作,所以直觉认为这可能与此有关。当我离开时:git clonegit@github.com:myuser/myrepo.git,我收到以下错误:

ssh: connect to host github.com port 22: Connection timed out

如何修复此错误?

您可以用修复任何ssh问题的方法来修复此错误。从等式中删除Git,然后尝试使用ssh登录。如果它起作用,你应该看到这样的东西

$ ssh git@github.com
PTY allocation request failed on channel 0
Hi schwern! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
如果它不工作,您需要调试ssh会话。通常通过使用ssh-v(并且可以添加更多的
-v
)来实现这一点

如果此时挂起,则可能是您根本无法连接到主机,或者端口22上没有ssh服务器侦听,或者该端口被防火墙阻止

因为这是Github,它肯定有一个ssh服务器,并且为我工作,所以我怀疑最后一个问题:你在防火墙后面。您可以通过尝试ssh到其他地方来测试这一点

在这种情况下,要么使用VPN绕过防火墙,要么尝试使用HTTPS连接

git clone https://github.com/myuser/myrepo.git

如果防火墙正在阻塞。
git clone https://github.com/myuser/myrepo.git