Categories
Technology

git push freezes and hung on compressing

Today something odd happened on one of the git repo I manage.

When I tried pushing my commit to the origin, it got to “compressing file” then hung there. Doubly worse, it was a server machine hosting a corporate website and it froze because of git.

At this point, even “git status” was not working. Frantically googling around I found that someone else has reported git’s inability to handle large files

Sure enough, that was my problem. The repo I was managing had a directory holding over 1GB of video data that I had just committed as new files. I am guessing git hogged up all the RAM in the small server machine while trying to process over 1GB of data, causing it to swap, bringing the machine down to a crawl.

The fix:

1) Remove the git directory, destroying the entire repo history (I made a backup first though): "rm -r .git"
2) added the “video” directory to the “.gitignore” file.
3) “git init” a brand new git repo and re-committed all the source files without the video files.

Note: Undoing the commit did not work for me. Not sure why. I am sure that had I been on a machine with more RAM, like my mac, I would be fine pushing and pulling 1GB.