我不知道为什么但是我的回购中有些东西搞砸了,当我试图把我的分支推到github时我得到一个错误:
> 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 'git@github.com: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
请注意,我不在乎删除或删除此文件,因此不再使用该文件。 (但文件在那里!)
我试过git-lfs untrack path/to/bigfile
但没有运气,我无法推动我的分支。
如何解决这个问题?
答案 0 :(得分:0)
无需修改历史记录即可修复损坏的lfs的方法:
# set origin to original repo
git remote set-url origin ssh://git@bitbucket.nl.xxx: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://git@bitbucket.nl.xxx: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://git@bitbucket.nl.xxx:7999/prod/B.git
git lfs fetch --all origin
git lfs fsck