升级至Ubuntu 22.04从 Ubuntu 20.04 开始,我遇到了一些git
命令问题。例如,一个简单的git clone
或git pull
来自 github 的命令会一直挂起/冻结,没有任何错误。
经过一番调查后,看起来问题出在ssh
。
这按预期工作:
$ ssh [email protected]
PTY allocation request failed on channel 0
Hi davideicardi! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
使用-T
(按照 github 的建议)它只是永远挂起:
$ ssh -T [email protected]
如果我使用-Tv
它在以下输出后停止:
debug1: Next authentication method: publickey
debug1: Offering public key: /home/davide/.ssh/id_ed25519 ED25519 SHA256:MY_PUB_KEY agent
debug1: Server accepts key: /home/davide/.ssh/id_ed25519 ED25519 SHA256:MY_PUB_KEY agent
Authenticated to github.com ([140.82.121.3]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_hostkeys: searching /home/davide/.ssh/known_hosts for github.com / (none)
debug1: client_input_hostkeys: searching /home/davide/.ssh/known_hosts2 for github.com / (none)
debug1: client_input_hostkeys: hostkeys file /home/davide/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Sending environment.
debug1: channel 0: setting env LC_ADDRESS = "it_IT.UTF-8"
debug1: channel 0: setting env LC_NAME = "it_IT.UTF-8"
debug1: channel 0: setting env LC_MONETARY = "it_IT.UTF-8"
debug1: channel 0: setting env LC_PAPER = "it_IT.UTF-8"
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: channel 0: setting env LC_IDENTIFICATION = "it_IT.UTF-8"
debug1: channel 0: setting env LC_TELEPHONE = "it_IT.UTF-8"
debug1: channel 0: setting env LC_MEASUREMENT = "it_IT.UTF-8"
debug1: channel 0: setting env LC_TIME = "it_IT.UTF-8"
debug1: channel 0: setting env LC_NUMERIC = "it_IT.UTF-8"
我尝试使用重新生成 ssh 密钥ed25519
但没有任何变化。
如果我运行,GIT_TRACE=true git pull
我会得到以下输出:
11:59:41.975683 git.c:460 trace: built-in: git pull
11:59:41.976410 run-command.c:654 trace: run_command: git fetch --update-head-ok
11:59:41.977594 git.c:460 trace: built-in: git fetch --update-head-ok
11:59:41.978231 run-command.c:654 trace: run_command: unset GIT_PREFIX; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL [email protected] 'git-upload-pack '\''MY_ORG/MY_REPO.git'\'''
路由器和互联网连接正确,因为另一台电脑可以正常工作。
我没有任何特定的 ssh 配置,我只是使用默认配置。
我也尝试重新安装 git,但是没有成功。
任何想法?
更新 1
使用IPQoS=throughput
修复问题,例如使用或添加到。另请参阅ssh -T -o IPQoS=throughput [email protected]
IPQoS throughput
/etc/ssh/ssh_config
IPQoS 选项。
但我不知道为什么...有人能解释一下吗?