Unable to push new commit from shallow clone
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
Problem
When trying to push new commits in a shallow clone to Bitbucket Server, the following error is returned:
fatal: protocol error: expected old/new/ref, got 'shallow <commit hash>'
Cause
When pushing commits from the command line from a local repository created from shallow clones, the push fails with the abovementioned protocol error. This functionality was added in Git version 1.9.
Resolution
Ensure you are running Git 1.9+ on both server and client side.