Rejected large files

Rejected Files

On the JSC gitlab server, a single file may not exeed the size of 20Mb, otherwise the push will be rejected:

> git push origin master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 553 bytes | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote: b0fd97d641cf2db0129faee2c4eeee768a9169ac..b6e4e93d5ec12229d42dd120548afe42183801d9 1048576
remote: 
remote: ---------------------------------------------------------------------------------------------
remote: Your push was rejected because it contains files larger than 20 MB.
remote: You might want to consider using git-lfs instead.
remote: ---------------------------------------------------------------------------------------------
remote: 
remote: Offending files:
remote:  - bigFile.avi
remote: 
To ssh://git@gitlab.version.fz-juelich.de:10022/user/test.git
! [remote rejected] master -> master (pre-receive hook declined)

Please keep in mind, that deleting a previously committed large file doesn’t solve the problem. The file stays in history. You have to undo the change e.g. with git reset. The following command makes the last commit undone (the changes are preserved as uncommitted local modifications).

git reset --soft HEAD~1  

Prevent commits of large files

For future commits, you may want to install a pre-commit hook to prevent committing large files.