Hi all,
I want to set GIT_DIR to another path than <project_dir>/.git. Unfortunately, git add or git status failed with the following error:
fatal: This operation must be run in a work tree
Unless I also set GIT_WORK_TREE, git status|add|stash|clean|... always fail.
git or git-config man pages does not state anything like this. Did I miss something ?
#test-case :
export GIT_DIR=$PWD/.gita && git init echo "file a" >> a.txt && git add a.txt #fail git status #fail
export GIT_WORK_TREE=$PWD git status #pass git add a.txt && git commit -m'file a' #pass
unset GIT_WORK_TREE git status #fail, it does not look like some bug related to a newly created, empty repository
Note: that using --git-dir instead of GIT_DIR give the same errors.
-- Fred