Search code examples
gitjenkinsrepo

Repo sync/Git clone is failed only from jenkins's slave


I execute repo sync from jenkins slave.

But error occured a specific repogitory.

Cloning into 'repo_name'...
Connection to xxx.xxx.xxx.xxx closed by remote host.
fatal: The remote end hung up unexpectedly

When I execute it manualy(not from jenkins), repo sync was success. Above error occured only when executed by jenkins's slave.

I also try to below cmd. But it is failed same error.

git clone ssh://user@xxx.xxx.xxx.xxx:port/path/to/reponame

I try to git config --global http.postBuffer 524288000 with reference to the following. But it is not fixed....

The remote end hung up unexpectedly while git cloning

I add --progress and --verbose for investigation

git clone --progress --verbose ssh://user@xxx.xxx.xxx.xxx:port/path/to/reponame

git clone was succeed!!

Why It is failed from jenkins's slave. Why It is succeed when added --progress --verbose.

Can I fixed it without --progress? (repo sync seems without --progress when execute from jenkins.)

Sorry for my poor English.


Solution

  • According to following

    https://issues.jenkins-ci.org/browse/JENKINS-9168

    When cloning a large repository over HTTP, the git server goes quiet for quite some time, busy computing a pack file. Normally, Apache is configured such that a prolonged inactivity in a socket will trigger a shutdown. So what the end user sees is that after a while, "git clone" fails by the unexpected connection reset by the server.

    But, I can't configure server because server is public server. So,

    If the user tries the same command from the shell, Git silently adds the --progress option (see the quote from the man page.) This keeps the socket chatty enough to avoid a shutdown from Apache.

    On the other, repo can't add --progress option. I don't have any other choice so I mod script of repo. (.repo/repo/git_command.py)