Pushing fails if local repo has problems with zero-padded file modes
Summary
GitLab refuses pushing an existing local repository to a newly created remote repository if running git fsck
reports about zero-padded file modes.
Steps to reproduce
Try pushing one of this repositories to a newly created remote repository on GitLab:
Expected behavior
Successfull push.
Actual behavior
Pushing to the remote fails.
Relevant logs and/or screenshots
For https://github.com/teeworlds/teeworlds this happens to me:
> git fsck --full
Checking object directories: 100% (256/256), done.
warning in tree 411ebc45beade8a2fe55914e7667b795f5e29bf2: zeroPaddedFilemode: contains zero-padded file modes
warning in tree ef726cdbc13e62798213b118a7be991b99fec355: zeroPaddedFilemode: contains zero-padded file modes
warning in tree 842a9b81fa1120e6c874d8d4cda8925ed2551a3e: zeroPaddedFilemode: contains zero-padded file modes
warning in tree 8c3b580e9c94e88af71a0741005fa37b5e560e51: zeroPaddedFilemode: contains zero-padded file modes
warning in tree b9afd1807f0256a6c34cf1e0a87ca72026fdd74e: zeroPaddedFilemode: contains zero-padded file modes
warning in tree b23abaab47a81ca8a22441d66c4e5d24d9d29866: zeroPaddedFilemode: contains zero-padded file modes
Checking objects: 100% (34737/34737), done.
(...)
> git push -u gitlab master
Counting objects: 31528, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7906/7906), done.
Writing objects: 100% (31528/31528), 68.65 MiB | 67.00 KiB/s, done.
Total 31528 (delta 23799), reused 31130 (delta 23426)
remote: error: object ef726cdbc13e62798213b118a7be991b99fec355: zeroPaddedFilemode: contains zero-padded file modes
remote: fatal: Error in object
error: unpack failed: index-pack abnormal exit
To git@gitlab.com:H-M-H/teeworlds.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'git@gitlab.com:H-M-H/teeworlds.git'
Possible fixes
Setting this option for the remote-repository enables pushing.
git config receive.fsckObjects false
Alternatively the history of the local repository can be rewritten to fix warnings about zero-padded file modes. This, however, will change all the SHA-Values and thus make life for everyone who cloned the repo pretty hard and is not always an option. Relevant StackOverflow answer about rewriting history: http://stackoverflow.com/a/14839059 .
Edit:
Probably this here is a better option as it will warn about zero-padded file modes but neither just ignore nor reject them:
git config receive.fsck.zeroPaddedFilemode warn