I have problems cloning repositories over HTTP in Jenkins. The problem only occurs for repositories with over 12 branches, or with a total of 18 branches and tags.
Running the following command:
git clone http://USERNAME:PASSWORD@bitbucket.company.org/scm/key/repo.git
The cloning works perfectly fine when there is 11 branches, or a total of 17 branches and tags. When it is above that number the cloning fails with the following error:
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
fatal: The remote end hung up unexpectedly
Bitbucket is running with loglevel DEBUG, and I couldn't find any more information in the logs.
Versions on server:
Bitbucket Server 5.14.0 Git 2.19.0
Versions locally:
Git 2.17.1
PS: I am not running Bitbucket behind a proxy.
I have checked the atlassian-bitbucket.log and it does show an error related to the cloning of the repository:
The following was written to stderr:
fatal: the remote end hung up unexpectedly
com.atlassian.utils.process.ProcessException: Non-zero exit code: 1
at com.atlassian.bitbucket.scm.SummarizingProcessHandler.complete(SummarizingProcessHandler.java:47)
...
I have tried to set the postBuffer:
git config --global http.postBuffer 524288000
I have tried to clone with Username and Password as input, and it still fails on more than 12 branches:
git clone http://bitbucket.company.org/scm/key/repo.git
The size of the repository does not matter as I am able to clone large repos with fewer branches.
It does work if I use SSH, but this is not an option for my use case. Since we have one release branch per release, and the number of tags do grow over time I would expect this to be a problem for other people as well.
As I am trying to clone in a Jenkins pipeline I have tried the following configuration to get more than just the shallow clone.
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: [
[
$class: 'CloneOption',
honorRefspec: false,
noTags: false,
shallow: false,
]
],
userRemoteConfigs: scm.userRemoteConfigs,
])
I would expect it to be able to clone the repositories no matter the number of branches. Does anyone have any idea on why this happens? Any help would be greatly accepted.