Git push over SSH - User session has timed out idling after 600000 ms.

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

 

問題

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' 'git@10.0.0.2' '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://git@10.0.0.2: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:

  1. 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:
    <git_installPath>\Git\etc\ssh\ssh_config

    Linux instruction...

    Linux users can locate the file at:

    ~/.ssh/config

  2. Add the following section to the file:

    Host *
         ServerAliveInterval 30
         ServerAliveCountMax 4
  3. Perform again the push operation.

 

最終更新日: 2016 年 9 月 4 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.