One of our guys pushed a commit that seems to be whole and working on his computer. Since then, none of the other computers is able to fetch changes from the remote repository. The error that everyone is getting is:
git.exe fetch -v --progress "origin"
POST git-upload-pack (gzip 1407 to 775 bytes)
remote: error: Could not read a75720ce47ae8dcc1d0b4c09fcb7d6f70efa390b
remote: fatal: revision walk setup failed
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header
git did not exit cleanly (exit code 128) (14368 ms @ 26/10/2014 11:49:05)
The SHA (a75720...) that can't be read is the SHA of said commit.
We've tried various things, but nothing seems to work. Running git fsck does not show the commit as dangling, and in the remote server, no branch is pointing to the commit.
Recovering data from the commit is not a priority, but getting the system working again is.
Any suggestions as to how to delete/fix the broken commit? Help would be greatly appreciated.
Thanks!
In your local machine you can rebase your master to the commit before the a75720.
Rollback to an old Git commit in a public repo
Then you can make a cherry-pick for the others commits. (you can spicify a list of commits)
How to cherry-pick multiple commits
Then, if all seems to be working, you have to make a force push.
git push --force origin desiredBranch
(specify the desired branch !!)
from: http://git-scm.com/docs/git-push
--force Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Also, when --force-with-lease option is used, the command refuses to update a remote ref whose current value does not match what is expected.
This flag disables these checks, and can cause the remote repository to lose commits; use it with care.
Note that --force applies to all the refs that are pushed, hence using it with push.default set to matching or with multiple push destinations configured with remote.*.push may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the ... section above for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With