Need to set GIT_WORK_TREE when setting GIT_DIR !?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]