我不知道为什么最近我的 git pull 开始挂起
我已经尝试过了
git fsck && git gc --prune=now
<小时/>
更新
网络防火墙
这是我在 Digital Ocean 的网络防火墙中设置的
我无法访问互联网,也无法 ping google
我无法从 bitbucket 执行 ping 或 ssh
<小时/>更新2
└── iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
└── ufw status
Status: inactive
<小时/>
更新3
我什至尝试在网络级别和服务器级别内部完全禁用防火墙。我看起来仍然相同结果
<小时/>更新 4
└── GIT_TRACE=1 GIT_CURL_VERBOSE=1 git pull
11:07:35.834628 git.c:344 trace: built-in: git pull
11:07:35.838802 run-command.c:646 trace: run_command: git fetch --update-head-ok
11:07:35.858628 git.c:344 trace: built-in: git fetch --update-head-ok
11:07:35.864635 run-command.c:646 trace: run_command: unset GIT_DIR GIT_PREFIX; ssh git@bitbucket.org 'git-upload-pack '\''jdoe/project.git'\'''
<小时/>
更新5
└── GIT_SSH_COMMAND="ssh -vvv"GIT_TRACE=1 git pull
12:09:17.835895 git.c:344 trace: built-in: git pull
12:09:17.836775 run-command.c:646 trace: run_command: git fetch --update-head-ok
12:09:17.838743 git.c:344 trace: built-in: git fetch --update-head-ok
12:09:17.839407 run-command.c:646 trace: run_command: unset GIT_DIR GIT_PREFIX; 'ssh -vvv' git@bitbucket.org 'git-upload-pack '\''jdoe/project.git'\'''
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "bitbucket.org" port 8200
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to bitbucket.org [18.205.93.1] port 8200.
<小时/>
更新 6
vi/etc/ssh/sshd_config
Port 8200
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
<小时/>
我还需要检查什么?
最佳答案
除了跟踪和协议(protocol)(在您的情况下为 SSH)之外,还要检查您从中提取数据的远程托管服务器的状态。
例如,GitHub had an incident yesterday ,这可以解释克隆/pull 请求中的一些延迟。
这个DigitalOcean thread提及:
I had to add outbound rule for SSH and DNS UDP
正如 our discussion 中提到的,问题是/etc/ssh/ssh_config
Do you know why I kept trying to connect to BitBucket at port 8200 instead of 22 ? Where is the settings for that ?
这是第一行:端口 8080 更改为 22
关于git pull突然挂了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60791371/