公司內(nèi)網(wǎng)搭建的gitlab砌烁,做了端口映射可以在家里訪問,但是git lfs pull的時(shí)候走不動(dòng)催式,檢查原因是lfs使用的依然是gitlab里設(shè)置的內(nèi)網(wǎng)地址函喉。所以決定移除工程的lfs支持:
代碼轉(zhuǎn)自 Simple steps to uninstall Git LFS from your repository · Issue #3026 · git-lfs/git-lfs (github.com)
#commit & push everything
#remove hooks
git lfs uninstall
#remove lfs stuff from .gitattributes
#list lfs files using
git lfs ls-files | sed -r 's/^.{13}//' > files.txt
#run git rm --cached for each file
while read line; do git rm --cached "$line"; done < files.txt
#run git add for each file
while read line; do git add "$line"; done < files.txt
#commit everything
git add .gitattributes
git commit -m "unlfs"
git push origin
#check that no lfs files left
git lfs ls-files
#remove junk
rm -rf .git/lfs
#you're all done
#(but unlinked junk is within BitBucket Git LFS storage still)
windows以上命令如果運(yùn)行不成功,可以自行安裝wsl執(zhí)行(略)
- 另一種方法針對(duì) git verison> 2.16荣月,可使用(未測(cè)試):
git lfs untrack '<pattern>'
git add --renormalize .
git commit -m 'Restore file contents that were previously in LFS'
<pattern>
可以換成*