简体   繁体   中英

Large file support: 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

I have a question about using git annex in windows. How can I have both, files tracked by git annex (large binaries that I don't want git to add to the repo) and other source code files that I want to add to the git repo, in the same repository if git annex must use direct mode on windows (and thus prevent me from using git add, git commit on my normal/non-annex files)?

Here are my steps:

  1. mkdir testrepo
  2. cd testrepo
  3. git init
  4. git annex init "testing annex"
  5. cp ~/test.png .
  6. git annex add test.png
  7. git annex sync
  8. vi normalfile.txt <--- add some text to a file, I want git to track this file
  9. git add normalfile.txt <--- here is the problem, since the repo is in direct mode, I cannot git add a file that I want git to track.

git add fails with fatal: This operation must be run in a work tree

You can "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

It's not very convenient, but it should work.

Alternatively, you can clone this repository and set it up as a working directory, to push from one to the other, at will.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM