13

Before that I got a problem error: object file is empty cause my laptop sunddenly turn off. I was fixed with this. My local repo was fixed and I try to pull and push to remote master. But I have a problem like this

$ git push -u origin master
Counting objects: 26, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (22/22), done.
fatal: unable to read c779d43453f63d871ba2a079b79f04558d9b0920
error: remote unpack failed: eof before pack header was fully read
error: failed to push some refs to 'git@bitbucket.org:xxxx/xxxx.git'

How to fix my remote repo? I can't push my new commit cause broken remote repo

How to fix unable to read c779d43453f63d871ba2a079b79f04558d9b0920 on remote repo?

DDK
  • 136
  • 1
  • 1
  • 11
Ibrohim Hanafi
  • 171
  • 1
  • 3
  • 7

9 Answers9

17

I'm on a shared hosting and I had the same problem while trying to push master for the first time.

But this did the trick:

git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
Julien
  • 953
  • 9
  • 15
12

I had this occur for me in a number of repos, I eventually traced it back to the repos being stored inside of my Dropbox and "selective sync" being applied. As a result the .git folder wasn't fully available locally.

Going into the folder in finder and selecting selective sync > local fixed it.

The parent folder was marked to be synced, but Dropbox seems to assume that hidden folders probably aren't important.

ChrisM
  • 1,576
  • 6
  • 18
  • 29
Jan
  • 133
  • 1
  • 5
11

I had a similar error with git 2.19.0 which was fixed by updating to git 2.20.1. I believe in my case git crashed while trying to compress a specific object (it only got to "Compressing objects: 31%") and then the server returned that error due to the sending process having crashed.

I hope this helps someone.

Thief
  • 369
  • 1
  • 5
  • 6
    Updating git fixed the issue for me as well, but it was 2.20.1 to 2.21.0 for me. Which leads me to believe that it is not a fix in the update, but rather a setting that is reset or a cache cleared during the update process. – Ewoud Mar 05 '19 at 08:36
  • Same for me. Upgraded from Git Scm 2.19 to 2.21 and then everything work like a charm ! – MrSo May 06 '19 at 18:01
8

It happened for me on macOS Big Sur and upgrading my git version fixed it. Initial version was 2.23.0, upgraded to git version 2.29.2.

obotezat
  • 1,041
  • 16
  • 20
6
git fsck

did the trick and solved it for me

Megacier
  • 394
  • 4
  • 9
4

I had the same problem yesterday, my laptop shut down unexpectedly. So I had to re-create git.

First of all, remove the .git folder from your directory.

rm -rf .git

Then create renew git.

git init

All the tracking will become new, so you have to commit all the new changes and add your remote repository

git remote add origin <repo URL>

If for example, you were on the "development" branch. Go ahead create a development branch

git branch development && git checkout development

Now after switching to the development branch, pull from the remote branch.

git pull origin development --allow-unrelated-histories

You may face conflicts, resolve them and you are good to go.

Nejat Njono
  • 254
  • 4
  • 9
3

Your local repository isn't fixed, because this message:

fatal: unable to read c779d43453f63d871ba2a079b79f04558d9b0920

came from your own Git, while it was trying to package data to send to the remote. (The way to know this is that it's not prefixed by remote:.) The remaining errors:

error: remote unpack failed: eof before pack header was fully read
error: failed to push some refs to 'git@bitbucket.org:xxxx/xxxx.git'

are consequences of this.

This problem has not affected the other repository in any way, so you can make a new clone of the other repository and do whatever you can to extract useful data from your not-quite-fixed repository to add to the new (good) clone.

torek
  • 448,244
  • 59
  • 642
  • 775
2

It can be due to comparatively large size/number of files in the commit. When tried with zipping, it worked for me

1

Another way this error can occur is when working with Git submodules and trying to push to the remote (even with --force) when the local repository has not pulled yet the newer references from the remote.

The solution for this use case is to update the submodule(s) like so:

git submodule update --remote

In this case, performing git fsck will also result in an error (commit hash cut off for brevity):

$ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (3628/3628), done.
error: refs/remotes/origin/some/branch: invalid reflog entry 1c857
Sébastien Lavoie
  • 877
  • 1
  • 11
  • 18