6

I have no idea why lately my git pull started to hang

I've tried this already

git fsck && git gc --prune=now

enter image description here


Update

Network Firewall

This is what I set in my Network Firewall at Digital Ocean

enter image description here

I cant get to internet, and ping google

enter image description here

I can't ping or ssh from bitbucket

enter image description here


Update 2

└── iptables -S                                                                                                                 
-P INPUT ACCEPT                                                                                                                   
-P FORWARD ACCEPT                                                                                                                 
-P OUTPUT ACCEPT                                                                                                                  


                                                                                      
└── ufw status                                                                                                                    
Status: inactive 

Update 3

I even tried to disabled the firewall completely on the networking level, and inside the server level.I still seem the same result


Update 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'\'''  

Update 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.   

Update 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  

What else do I check ?

Community
  • 1
  • 1
code-8
  • 54,650
  • 106
  • 352
  • 604
  • Close any programs you have open that uses this repository (VS Studio for example). also, you can do `GIT_TRACE=true git pull` to find out where it hangs. – fredrik Mar 21 '20 at 18:02
  • You can check this for a few things to check: https://stackoverflow.com/questions/44031150/why-does-git-pull-hang – fredrik Mar 21 '20 at 18:03
  • 1
    If you're using SSH, run `GIT_SSH_COMMAND="ssh -vvv" GIT_TRACE=1 git pull` , and if you're using HTTPS, run `GIT_TRACE=1 GIT_CURL_VERBOSE=1 git pull`, and include the output as a text block in your question. – bk2204 Mar 21 '20 at 18:04
  • 1
    Check firewall rules, resolver settings (if you are using DHCP the resolver can be broken by the server), etc. I bet it waits for DNS timeout (leave it for few minutes to check). – 0andriy Mar 21 '20 at 22:26
  • 1
    Just as a general rule, when something hangs, see if you can simplify it. Since `git pull` runs `git fetch` followed by `git merge` (or some other second Git command), see if `git fetch` hangs. If so, find out whether you're fetching over SSH or HTTP or HTTPS transport, and try `ssh` or `curl` or whatever command you have that implements *just* that protocol to see if *that* hangs. If so, check whether name resolution works and whether *any* network operations hang. If so, keep digging there, etc. – torek Mar 22 '20 at 00:11
  • @0andriy, Thanks for the hint, I did tried everything I can on the firewall. I even tried to disabled on the Digital Occean, and in the server completely, that still happening. – code-8 Mar 25 '20 at 14:05
  • Check that SSH server accepted your kernel. It was a recent update to OpenSSH server to reject some keys. – 0andriy Mar 25 '20 at 16:21
  • Incredible: I did mentioned explicitely (and in my answer) the /etc/ssh/ssh_config file in [our discussion](https://chat.stackoverflow.com/rooms/210339/discussion-between-vonc-and-cyber8200). So much timed passed for so little. – VonC Mar 29 '20 at 16:57
  • @VonC : You're right ! I missed that message in your chat. I changed to accept your answer instead. sorry for that, you deserved it, you said it first. ✨ – code-8 Mar 29 '20 at 18:54

3 Answers3

4

In addition of traces, and protocols (SSH in your case), check the status of the remote hosting server you are pulling from.

For instance, GitHub had an incident yesterday, which can explain some delay in clone/pull request.

This DigitalOcean thread mentions:

I had to add outbound rule for SSH and DNS UDP

As mention in our discussion, the issue was /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 ?

That was the first line: Port 8080 to change to 22

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I don't have ufw running. It's inactive at the moment. – code-8 Mar 25 '20 at 14:02
  • I added the result of my server level firewall on my *Update 2*, please have a look and kindly update your answer. – code-8 Mar 25 '20 at 14:04
  • @cyber8200 As commented, what is the output of `GIT_TRACE=1 GIT_CURL_VERBOSE=1 git pull` (if your remote URL is an HTTPS one) – VonC Mar 25 '20 at 14:29
  • I added *Update 4*, please have a look. It has the result you're looking for. – code-8 Mar 25 '20 at 16:09
  • @cyber8200 So... that is an SSH URL then: `GIT_SSH_COMMAND="ssh -vvv" GIT_TRACE=1 git pull` – VonC Mar 25 '20 at 16:13
  • I added Update 5 with the output of that command `GIT_SSH_COMMAND="ssh -vvv" GIT_TRACE=1 git pull` – code-8 Mar 25 '20 at 17:10
  • Do you know why I kept trying to connect to BitBucket at port 8200 instead of 22 ? Where is the settings for that ? – code-8 Mar 25 '20 at 17:28
  • @cyber8200 Possibly in `/etc/ssh/ssh_config` or in `~git/.ssh/config` – VonC Mar 25 '20 at 17:30
  • I see port `8200` in my `/etc/ssh/ssh_config`, but nothing in `.git/config` – code-8 Mar 25 '20 at 18:17
  • @cyber8200 if that rule applies to '*', that would impact all ssh calls – VonC Mar 25 '20 at 18:24
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/210339/discussion-between-vonc-and-cyber8200). – VonC Mar 25 '20 at 21:24
1

As i see your outgoing ssh connection is going throught port 8200 instead of 22.
So please make sure to check the line start with Port 22 in file /etc/ssh/ssh_config , you should comment it out if it enabled.

nct
  • 325
  • 3
  • 5
  • Wow , you're right, that is exactly what happened, I will make sure not to touch **/etc/ssh/ssh_config**, keep it as default. – code-8 Mar 29 '20 at 15:57
0

Why are you trying to connect to bitbucket.org via port 8200?

Shouldn't you be using port 22?

Also bitbucket.org has disabled ping on their end, so to test your connectivity to the site you an do:

curl -skLi bitbucket.org

Ron
  • 5,900
  • 2
  • 20
  • 30
  • I update my ssh port to 8200. I didn’t used default 22. – code-8 Mar 28 '20 at 12:45
  • Curl is for you to check and troubleshoot. – Ron Mar 28 '20 at 16:29
  • The ssh port on Your machine is 8200, which is fine, but I see you are trying to connect to `debug2: resolving "bitbucket.org" port 8200 ` which should be `debug2: resolving "bitbucket.org" port 22` – Ron Mar 28 '20 at 16:30