Git hangs while writing objects
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')
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.