Git hangs while writing objects
Solution 1:
I followed VonC's advice:
git config --global http.postBuffer 524288000
For future references, based on comments:
500 MB: 524288000 (as posted in the original answer)
1 GB: 1048576000
2 GB: 2097152000 (anything higher is rejected as 'out of range')
Solution 2:
This was happening because of huge, unignored file in the repo directory. Whoops.
EDIT
The hang was because the file was taking a long time to upload. The file wasn't supposed to have been included in the push.
EDIT
While it's true that a huge file could be the reason behind this issue, if you can't ignore the file in question or just have to push it then follow this answer.
Solution 3:
I had the same problem with (writing objects %16) stuck then fatal. I solved this by saving the current changes and clone a new repository, then copy the modified files into it.
Eg. Assume current repository is A, then all you need to do is:
mv A B
git clone A
mv B/* A/
rm -rf B
Then commit and push and it all worked fine. It recognized the moved files as modified :)