Git push fails with the error: remote: BEGIN failed--compilation aborted
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 pushing to Bitbucket Server, it responds with the output below:
git push -u
...
remote: Can't locate strict.pm in @INC (@INC contains: /usr/local/lib64/perl5 /u sr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl / usr/lib64/perl5 /usr/share/perl5 .) at /usr/lib64/perl5/IO/Handle.pm line 261.
remote: BEGIN failed--compilation aborted at /usr/lib64/perl5/IO/Handle.pm line 261.
remote: Compilation failed in require at /usr/lib64/perl5/IO/Socket.pm line 12.
remote: BEGIN failed--compilation aborted at /usr/lib64/perl5/IO/Socket.pm line 12.
remote: Compilation failed in require at /data/bitbucket/bin/git-hooks/hook-call back.pl line 15.
remote: BEGIN failed--compilation aborted at /data/bitbucket/bin/git-hooks/hook- callback.pl line 15.
To ssh://bitbucketremote/repo/repo1.git
! [remote rejected] mark-test -> mark-test (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@bitbucketremote/repo/repo1.git'
A corruption error can also be shown in the logs:
git push -u
...
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
Cause
This error can be caused by various reasons such as:
- The Perl version installed in the server is not Supported;
- Corrupted Perl Libraries.
Resolution
Try to re-install Perl in the attempt to resolve this.
If the issue still occurs, try to remove all git version on the server and re-install Git or at least Perl.