解决git pull卡住问题
最近发现执行git pull的时候卡住,没任何输出,也没有报错。
尝试重新使用git clone代码,发现依然卡住。不报错,没输出。
因为是通过ssh的方式链接git的,所以试了一下通过ssh链接
ssh -v git@github.com
OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [20.205.243.166] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
debug1: Remote protocol version 2.0, remote software version babeld-dd067d10
debug1: compat_banner: no match: babeld-dd067d10
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
直接就卡在expecting SSH2_MSG_KEX_ECDH_REPLY不动了。
查询了一番资料后,加了个参数解决
ssh -o MACs=hmac-sha2-256 -v git@github.com
接下来在~/.ssh/config文件中加上这行参数,git就能正常使用了
Host github
Hostname github.com
User git
IdentityFile ~/.ssh/id_rsa
MACs hmac-sha2-256
看到网络上其他人通过修改网卡的MTU来解决问题,这个是万万不可的。
改了网卡的配置,服务器所有网络相关的通信都有可能受影响,不能因为一个ssh/git的问题就修改网卡的配置。
CreateBy:2023-10-24T16:24:31+08:00,UpdateBy:2023-10-24T16:24:31+08:00
版权声明:署名-非商业性使用-禁止演绎 3.0 未本地化版本 (CC BY-NC-ND 3.0)
留言板开发中,站长邮箱:admin@aliencn.net。欢迎交流。