Expected Behavior
I edited file1, committed, and did this
$ git push
NOTICE: Only authorized blah blah blah...
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 676 bytes | 0 bytes/s, done.
Total 7 (delta 4), reused 0 (delta 0)
To ssh://me@server:/opt/git/fooBar.git
28ad03d..73ae492 master -> master
$
Problem
Then I edited file2 in the same project, committed and did this:
$ git push
NOTICE: Only authorized blah blah blah...
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (10/10), 1.42 KiB | 0 bytes/s, done.
Total 10 (delta 4), reused 0 (delta 0)
^C
Notice how I had to CTRL-C (^C
) at the end? That's because it never completed. This is NOT the expected behavior.
Failed Coping Mechanisms
So I:
cd ..
mv fooBar/ fooBar_bak/
git clone ssh://me@server:/opt/git/fooBar.git
cd fooBar
Edit some other text file (just added a blank line), pushed, and it worked. This means I did a successful push from/to the same local/remote repositories before and after the failed push.
But edit file2 it didn't like before? The push never completes. Same thing with file3 which it doesn't like either. I don't see anything special about these files.
Well, file2 and file3 are UTF-8 and file1 is ASCII, but that shouldn't matter. Should it?
I tried all the solutions at git push hangs after Total line but none worked for me.
I didn't really understand the output of strace -efile -f git push
but nothing jumped out at me.
I waited. But this is not a big repo or a big file.
I'm using Ubuntu 16.04 with git version 2.7.4 on my machine and git version 1.7.1 on the CentOS server. I don't have msysgit, git-for-windows, or cygwin installed.
git push -u origin master
didn't work either.
git config http.postBuffer 524288000
didn't make any difference.
GIT_CURL_VERBOSE=1
and GIT_TRACE=1
had no effect.
git config --global core.askpass "git-gui --askpass"
didn't do anything, probably because I don't have git-gui installed.
@RonanDejhero's suggestion here: https://stackoverflow.com/a/21032615/1128668 was what allowed me to see that some files can be changed, committed and pushed and some cannot. I tried copying the changed files, changing the files manually, and making slightly different changes: no good.
On the server I did sudo chown -R me.git-users /opt/git/
but that didn't make a difference either. When I've had problems like this in the past, that seemed to help.
I did a git gc
in my local repo and on the server in /opt/git/fooBar.git. No joy.
Update
I deleted my local repo, cloned, edited file2 (which git didn't like being edited before) by only adding a blank line. Committed, pushed, it worked! Then I commented out a dozen lines of unused code, committed pushed, and it worked! Could I have introduced a character or something that git didn't like?