Skip to content

Instantly share code, notes, and snippets.

@chaudharisuresh997
Created February 11, 2020 08:30
Show Gist options
  • Save chaudharisuresh997/1333f678f90d69db2b8262fc363530d9 to your computer and use it in GitHub Desktop.
Save chaudharisuresh997/1333f678f90d69db2b8262fc363530d9 to your computer and use it in GitHub Desktop.
Git loose oebject error
https://stackoverflow.com/questions/4254389/git-corrupt-loose-object
Your best bet is probably to simply re-clone from the remote repo (ie. Github or other). Unfortunately you will lose any unpushed commits and stashed changes, however your working copy should remain intact.
First make a backup copy of your local files. Then do this from the root of your working tree:
rm -fr .git
git init
git remote add origin [your-git-remote-url]
git fetch
git reset --mixed origin/master
git branch --set-upstream-to=origin/master master
Then commit any changed files as necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment