gpt4 book ai didi

git - 大文件支持 : Normal files and git annex files in the same repo on windows? git add fails with fatal: This operation must be run in a work tree

转载 作者:太空狗 更新时间:2023-10-29 13:47:02 24 4
gpt4 key购买 nike

我对使用 git annex 有疑问在 window 里。如果 git annex 必须,我怎么能同时拥有 git annex 跟踪的文件(我不想让 git 添加到 repo 的大型二进制文件)和我想添加到 git repo 的其他源代码文件,在同一个存储库中在 Windows 上使用直接模式(从而阻止我在我的普通/非附件文件上使用 git add、git commit)?

这是我的步骤:

  1. mkdir 测试库
  2. 光盘测试库
  3. 初始化
  4. git annex init "测试附件"
  5. cp ~/test.png 。
  6. git 附件添加test.png
  7. git附件同步
  8. vi normalfile.txt <--- 向文件添加一些文本,我希望 git 跟踪该文件
  9. git add normalfile.txt <--- 这就是问题所在,因为 repo 处于直接模式,我无法 git 添加我希望 git 跟踪的文件。

git add 失败并出现 fatal error :此操作必须在工作树中运行

最佳答案

您可以 "proxy" commands to git this way :

git annex proxy -- git revert HEAD

git annex proxy -- git checkout HEAD^^

git annex proxy -- git mv mydir newname

这不是很方便,但应该可以。

或者,您可以克隆此存储库并将其设置为工作目录,以随意从一个目录推送到另一个目录。

关于git - 大文件支持 : Normal files and git annex files in the same repo on windows? git add fails with fatal: This operation must be run in a work tree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29788082/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com