[英]Files are still (not) in GIT LFS after changing .gitattributes
When using GIT LFS , .gitattributes
controls which files are managed by GIT LFS and which ones are not.使用GIT LFS 时,
.gitattributes
控制哪些文件由 GIT LFS 管理,哪些不是。 According to the documentation, all it takes to move files between GIT LFS and regular GIT storage is to change .gitattributes
.根据文档,在 GIT LFS 和常规GIT存储之间移动文件所需的只是更改
.gitattributes
。
I have modified .gitattributes
in a Bitbucket repository, but git lfs ls-files
still lists the same files as before, including files that should no longer be managed by GIT LFS and not including files that should now be managed by GIT LFS.我已经修改了 Bitbucket 存储库中的
.gitattributes
,但git lfs ls-files
仍然列出了与以前相同的文件,包括不应再由 GIT LFS 管理的文件,也不包括现在应由 GIT LFS 管理的文件。 Also, committing and pushing the change in .gitattributes
is suspiciously fast.此外,提交和推动
.gitattributes
的更改.gitattributes
非常快。
Is there a command that I can (or have to) run to update the GIT LFS status of all files and move them to the correct storage?是否有我可以(或必须)运行的命令来更新所有文件的GIT LFS状态并将它们移动到正确的存储?
Well, it seems that git lfs
have to be used like git lfs track something.bin
, and manually change .gitattributes
won't really add exist files to LFS.好吧,似乎
git lfs
必须像git lfs track something.bin
一样使用,并且手动更改.gitattributes
不会真正将.gitattributes
文件添加到 LFS。
If you manually modify the .gitattributes
file, my solution is:如果手动修改
.gitattributes
文件,我的解决办法是:
After modify the file, run these commands:修改文件后,运行以下命令:
git rm --cached -r .
git add -A
It may take a while if there is a lot of files.如果文件很多,可能需要一段时间。 But it does the trick.
但它确实有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.