0

Git is running very slowly and it seems it's because of some corruption in the commits. I can push, pull, I can add commits, do whatever I like -- but it's extremely slow and I want to have this fixed. git fsck --full gives this output:

$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (594/594), done.
error: bad ref for .git/logs/HEAD[Conflict]
dangling blob 8878936a624d253188a7d3fb6826127ed4ef5559
dangling tree 3ffae6058ee5efdbf19b4bce8121a13269b03efd
dangling commit 6f8bcab8772694419ebd1e05c91b4dfdbc2e00d0
dangling blob 02ecfc281060f70d07001f78fe52b563bbe8c7cf
dangling blob a2a462441865b7a5e93b122cc8198a4aad24f8d3
dangling blob 05cf7cb901a50715d12aee741afcd348f1508d58

I've also run git gc and it didn't really fix anything.

I have a lot of files in the directory though that are intentionally not in the repo but which I wish to keep. All commits have been pushed already into the remote repo. What's the best way to get rid of the bad ref for .git/logs/HEAD[Conflict] problem?

irene
  • 2,085
  • 1
  • 22
  • 36
  • 1
    What operating system are you running on? Are you using a third-party antivirus, firewall, or monitoring software? Are you running the repository out of a directory that's managed by a cloud syncing service? – bk2204 Dec 30 '20 at 19:37
  • I'm on Windows. I was able to solve it finally, and will post an answer below. – irene Dec 31 '20 at 07:07

1 Answers1

0

Ended up fixing it this way similar to this answer:

  1. Used git clone to get the files from the remote repo into a new local folder (say, /remote_backup.
  2. Checked out the branch that should be identical to the local copy (important!)
  3. Created a new folder /local_new.
  4. Copied all the files from the original folder to /local_new except for the .git folder.
  5. Copied the .git folder from /remote_backup into /local_new.
  6. git init in /local_new
irene
  • 2,085
  • 1
  • 22
  • 36