Blog Post - 19. September 2016
Fixing slow Bitbucket git connections via SSH

Fixing slow Bitbucket git connections via SSH

In the last days I've experienced very slow connections when pushing new commits to Bitbucket via shell or via SourceTree. The push of a commit with just one file changed took about 60 seconds or even more. After googling around without finding any helpful answers, I lived with the problem for some days. Today I decided to debug the ssh connection while pushing (why didn't I do that first ...).

ssh -Tv git@bitbucket.org
[...]
debug1: Connecting to bitbucket.org [2401:1d80:1010::152] port 22.
debug1: connect to address 2401:1d80:1010::152 port 22: Operation timed out
debug1: Connecting to bitbucket.org [104.192.143.2] port 22.
debug1: Connection established.
[...]

It turned out that the SSH connection via IPV6 had a timeout and afterwards IPV4 is used. This happend with every commit. As a quick fix, I decided to turn off IPV6 for SSH and added

[...]
AddressFamily inet # IPv4 only
[...]

to my /etc/ssh/sshd_config file. Afterwards I restarted my OSX to completely have sshd restarted and everything worked just fine again.