We are using Gerrit for our Git repository. On a project that has been active for several months, we are suddenly unable to push any changes. When we execute git pus
I had the same problem. To solve this I used git fetch then I pushed again and it worked just fine.
Back it up... back it up right this second before you try anything.
Now, that sounds unfortunate. It's also a shame that it doesn't sound like you have a regular backup to go to. There is good news to be had, though: I bet your developers have this file, though it may be in a pack file. Try the following in somebody else's .git directory. Note that git uses the first two characters of the hash for the directory name.
find . -name d62f0ed4385e3f68f226ac133fa9932a9c65c9
If that shows up, copy that file to the same relative path on your server, and life should move on nicely. If not, then try this:
find . -name \*.idx -exec cat {} \; | git show-index | grep 14d62f0ed4385e3f68f226ac133fa9932a9c65c9
That won't show you which pack file it is (you can quickly script this or do it manually), but it will tell you its there. Find the right pack file and expand it...
git unpack-objects $FILE
From there, copy the file to the same relative path on your server. If that doesn't solve it, further work is needed. Swapping a developer's up-to-date-enough repository might fix things. You may also want to explore https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F, or post update comments and wait for me to get back around to this.
Quick solution is Fetch -> Rebase-> Commit and then Push.
Try to do first
git gc
then do
git push
Got same problem. above solution worked for me.
If not on master branch, you can simply delete the remote branch by:
git push --delete origin <branch_name>
And then push your branch back to the remote:
git push -u origin <branch_name>
Use git push --no-thin
instead of git push
.
From Git docs:
A thin transfer significantly reduces the amount of sent data when the sender and receiver share many of the same objects in common. The default is --thin.