Reputation: 8958
Im not sure why but something is a little screwed up on my repo and when I try to push my branch to github I get an error:
> git push
Git LFS: (0 of 1 files) 0 B / 61.99 MB
LFS upload failed:
(missing) path/to/bigfile (50...4b)
error: failed to push some refs to '[email protected]:me/myproject'
> git-lfs ls-files
50.. - path/to/bigfile
> git-lfs fsck
Object path/to/bigfile (50...4b) could not be checked: no such file or directory
Object path/to/bigfile (50...4b) could not be checked: no such file or directory
Moving corrupt objects to /Users/myname/.../.git/lfs/bad
rename /Users/myname/.../.git/lfs/objects/50/b6/50...4b
/Users/myname/.../.git/lfs/bad/50...4b: no such file or directory
Note that I don't care removing or deleting this file, it is not used anymore. (but the file is there!)
I have tried to git-lfs untrack path/to/bigfile
but no luck, and I can't push my branch.
How to fix this?
Upvotes: 4
Views: 4897
Reputation: 31
Recipe to fix corrupt lfs without rewrite history:
# set origin to original repo
git remote set-url origin ssh://[email protected]:7999/prod/A.git
git lfs update
# fetch lfs data from original repo
git lfs fetch --all origin
# set origin back to new repo
git remote set-url origin ssh://[email protected]:7999/prod/B.git
git lfs update
# get missing lfs data from new repo
git lfs fetch --all origin
# push missing lfs data in new repo
git lfs push –all origin
# final check
git clone ssh://[email protected]:7999/prod/B.git
git lfs fetch --all origin
git lfs fsck
Upvotes: 3