How to fix a Corrupted InfatedEnd or Loose Objects GIT Branch

A Great GIT modelling example

A Great GIT modelling example

This kind of error can occur if you haven’t performed a ‘git gc’ on your local repository. If you are using a Virtual Machine (VM) and have experienced a machine reboot accidentally or did not without quit the VM properly this same problem could occur.

No you are not up the creak without a paddle, there is a way to fix your branch repository.

The following things are what you may notice;

  • You cannot push to origin (bad ref/head)
  • You cannot check out a specific branch (see screenshot below)
  • You cannot remove ‘git rm’ or ‘git fsck’ your local repo.

The likelihood is that your remote repo is OK.  The problem is your local repo.  The following commands will be able to help;

Step-by-step guide

Ok let’s keep this simple, here is a easy set of instructions on how to fix a Corrupted InfatedEnd or Loose Objects GIT Branch

  1. Open up Windows Explorer and navigate to your local repo files manually (the folder should be the folder that is the project source on your personal computer)
  2. Re-name that folder. DO NOT DELETE IT YET.
  3. If your git file path is within the application folder.  ‘cd..’ to go up a level and out of the folder.
  4. Run the following command immediate in your git command line “git clone git@codebasehq.com:path”
  5. You should start to see the project folder being re-cloned.

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *