Git push over SSH - User session has timed out idling after 600000 ms.
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
Sometimes pushing large changesets in a Git repository over SSH (common when doing the first push on a newly created repository) fails due to idling timeout.
The following appears in the git command output:
$ git push -u origin master 16:32:03.160072 git.c:350 trace: built-in: git 'push' '-u' 'origin' 'master' 16:32:03.222659 run-command.c:336 trace: run_command: 'ssh' '-p' '7999' 'firstname.lastname@example.org' 'git-receive-pack '\''/tst/repository.git'\''' Enter passphrase for key '/c/Users/username/.ssh/id_rsa': 16:32:11.773693 run-command.c:336 trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' 16:32:11.873262 git.c:350 trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' Counting objects: 22632, done. Delta compression using up to 4 threads. Received disconnect from 10.0.0.2: 2: User session has timed out idling after 600000 ms. Disconnected from 10.0.0.2 fatal: The remote end hung up unexpectedly Compressing objects: 100% (21794/21794), done. fatal: sha1 file '<stdout>' write error: Broken pipe error: failed to push some refs to 'ssh://email@example.com:7999/tst/repository.git'
The reason for the failure is due to the fact that while pushing on Bitbucket the server needs to perform backgroud operations and the SSH connection will reamin idle for long time, hence causing the timeout.
Huge pushes are not common in the usual Git workflow, so it is better to avoid altering the Bitbucket server backend SSH configuration.
It is possible to tweak the configuration of the client workstation to modify the
ServerAliveInterval for SSH connection.
ServerAliveInterval will send a null packet to the remote server every x seconds to keep the connection alive:
Open the SSH config file (or crete it if it does not exist) on your client workstation:Windows instruction...
Windows users can locate the file at:
Linux users can locate the file at:
Add the following section to the file:
Host * ServerAliveInterval 30 ServerAliveCountMax 4
- Perform again the push operation.