I start up Ubuntu Linux, open a terminal, edit some code, and happily execute
git push origin master
However, after some period of time (sometimes 30 mins, sometimes a few hours), the exact same command will hang (no output at all).
When I try
ssh -v git@github.com
I get the following response:
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /home/avitus/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: auto-mux: Trying existing master
And then it hangs again. It seems as though I can no longer use SSH to git once I’ve SSH’ed to another server. Any ideas how to fix this? It is killing me having to reboot each time.
Update:
The problem goes away when I remove the following two lines (intended to facilitate connection sharing) from ~/.ssh/config
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
Just turning my guess from a comment into an answer…
The last line in the output of
ssh -v:… tells you that SSH has been configured to look for an existing SSH connection to reuse. I suspect that this existing connection eventually gets stuck in some way, which would explain the behaviour you’re seeing.
This connection sharing facility is described in the
ControlMastersection of thessh_config(5)man page. Essentially the “master” SSH session creates a socket in/tmpwhich later sessions can connect to instead of having to go through the potentially length authentication step again. You have this option set toauto, which means that this socket will be created and used automatically.