简体   繁体   English

Git (SSH) 在克隆/推/拉期间挂起

[英]Git (SSH) hangs during clone/push/pull

Whenever I try and perform an operation using git (eg clone , pull , or push ) over SSH the git client seems to hang and time out indefinitely (I've left it running for half an hour to no avail).每当我尝试通过 SSH 使用git (例如clonepullpush )执行操作时,git 客户端似乎会无限期挂起并超时(我让它运行了半小时但无济于事)。 I have my SSH keys loaded (using BitBucket).我已经加载了我的 SSH 密钥(使用 BitBucket)。 I am able to perform anything I need via HTTPS, and SSH is the only thing that appears to break.我能够通过 HTTPS 执行任何我需要的操作,而 SSH 是唯一似乎会中断的东西。

Here is some console output from an attempted pull这是尝试拉取的一些控制台输出

$ GIT_TRACE=1 git pull
16:44:05.679911 git.c:344               trace: built-in: git 'pull'
16:44:05.681453 run-command.c:334       trace: run_command: 'fetch' '--update-head-ok'
16:44:05.686650 exec_cmd.c:120          trace: exec: 'git' 'fetch' '--update-head-ok'
16:44:05.697849 git.c:344               trace: built-in: git 'fetch' '--update-head-ok'
16:44:05.703211 run-command.c:334       trace: run_command: 'ssh' '-p' '7999' 'git@git.myCompany.com' 'git-upload-pack '\''/ei/myProject.git'\'''

Anyone have any idea what could be happening?任何人都知道会发生什么?

7999 is a non-standard port which is likely to be blocked. 7999 是一个非标准端口,很可能会被阻塞。

If port 22 is not blocked (and that is a big if), then you can consider an ssh tunneling :如果端口 22 没有被阻塞(这是一个很大的 if),那么您可以考虑使用 ssh 隧道

ssh -R 7999:localhost:22  git@git.myCompany.com 

If you have a machine where git is working, you can compare the ssh configuration file of the nonworking to the working machine.如果你有一台 git 正在工作的机器,你可以将非工作机器的 ssh 配置文件与工作机器进行比较。

The ssh config file is located at /etc/ssh/ssh_config ssh 配置文件位于/etc/ssh/ssh_config

In my case, git was working fine on Windows but not WSL2.就我而言,git 在 Windows 上运行良好,但在 WSL2 上运行良好。 In windows the port was set to 22 while in WSL2 it was set to 2200. I changed it to 22 and was able to continue using git on wsl2.在 Windows 中,端口设置为 22,而在 WSL2 中设置为 2200。我将其更改为 22,并且能够继续在 wsl2 上使用 git。

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

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