Ubuntu Git pull or push or fetch does not work

If you are having issues in Ubuntu with Git, most likely the update packages have made changes to your ssh configurations. So first test out your connection as follow

ssh -Tv bitbucket.org #for bitbucket

or

ssh -Tv GitHub.com # for github

You will see the log will be stuck at the “connecting to bitbucket.org …. port 22” and it will hang there.

The problem here is that it is trying to use IPv6 instead of IPv4. Specially bitbucket need IPv4 to connect. Here is the fix.

  • go to /etc/ssh
  • open ssh_config
  • uncomment AddressFamily and change any to inet
#following line should be in the ssh_config

AddressFamily inet

Now test with your ssh -Tv and it should connect and your git commands should work.