问题:git lfs migrate import
将所有内容转换为哈希,包括 .gitignore 和所有纯文本文件。
在本地,我在 .cache 和 .vscode-server 映射中获得了 10k 个未跟踪文件,我不想跟踪这些文件。
更糟糕的是我无法编辑任何文本文件 -> 所有内容都变成了带有哈希值的 3 行文件!
远程 Github 文件现在都是:使用 Git LFS 存储
甚至我的 .gitignore 也如下所示:
version https://git-lfs.github.com/spec/v1
oid sha256:5dc008478f60b91b2ca91405adf351b4d253a254cd77604fe3a86bba855eac8e
size 7036
简史
- 本地 git 存储库添加了一个大的 .bak 文件。因此推送到远程(Github) 失败了。
- 在本地安装了 LFS(技术上是不同的开发机器) 通过 SSH)
git lfs install
git lfs track "*.bak"
git add .gitattributes
git lfs status
git lfs migrate
git lfs migrate info
git lfs migrate import
git pull
git push
最后 3 行肯定是严重错误 - 尤其是 git lfs migrate import
我应该指定要导入的文件类型。 请参阅Git LFS git lfs migrate import include all file types specified in .gitattribute?
我的 .gitattributes 文件包含所有扩展名
*.bak filter=lfs diff=lfs merge=lfs -text
*.bash_history filter=lfs diff=lfs merge=lfs -text
*.gitignore filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.md filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.json filter=lfs diff=lfs merge=lfs -text
*.txt filter=lfs diff=lfs merge=lfs -text
更多文件类型如下
我只想将 .bak(可能还有 .zip)转换为 LFS。
如何解决这个困惑?
首要任务是在本地获取原始文本文件(.txt、.gitignore、.json、.md、.html 等)。
第二优先级实际上是推送到远程。
最佳答案
如果您想继续使用 Git LFS 但只想恢复文件以保留其内容,请使用 git lfs checkout
.
关于git - 如何修复 git lfs migrate 导入更改?恢复使用 Git LFS 存储的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70876784/