Clones fail with suboptimal pack - out of memory
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When attempting to clone a repository being hosted via Bitbucket Server/Data Center, the clone fails.
Environment
- Any version of Bitbucket Server or Bitbucket Data Center
- Any git version
- The below error will be printed for any standard
git clone
command issued via the command line, but the clone will fail for any git client used to complete the clone - though possibly with a different error. - It's likely that only certain repositories are impacted (namely large repositories).
Diagnosis
The following can be seen in the console after running the standard git clone
command against this repository:
remote: warning: suboptimal pack - out of memory
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
The above error likely does not occur, however, for smaller repositories - such as a new repository with no files added to it yet.
Cause
The above error can be seen for a variety of reasons, such as a large repository or not enough system resources - namely to where git is unable to create the pack files necessary to complete the clone operation.
Solution
Lower the pack size limit and window memory with the following steps.
- Locate the repository on disk. The path to the repository should be in the "Repository Settings" on the repository page in the Bitbucket UI.
- Navigate to that location
Run the following
git config pack.windowMemory 1g git config pack.packSizeLimit 2g
- If the clone still fails, lower the values until you are able to clone.
These changes will survive Bitbucket restarts.
If you continue to receive an "early EOF" error that doesn't include the previous lines with "suboptimal pack - out of memory", it's recommended you also review the following knowledge article along with the other 'early EOF' errors listed in our Troubleshooting Git documentation: