From: "Frédéric Heitzmann" <frederic.heitzmann@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: Need to set GIT_WORK_TREE when setting GIT_DIR !?
Date: Fri, 9 Mar 2012 23:51:48 +0100 [thread overview]
Message-ID: <CALeToSUaPzdr=u7FfwHEtEanphVP5LZ09QdQXno52PLBTK0H-g@mail.gmail.com> (raw)
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
next reply other threads:[~2012-03-09 22:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-09 22:51 Frédéric Heitzmann [this message]
2012-03-09 23:06 ` Need to set GIT_WORK_TREE when setting GIT_DIR !? Junio C Hamano
2012-03-10 13:23 ` Frédéric Heitzmann
2012-03-10 14:05 ` Nguyen Thai Ngoc Duy
2012-03-10 21:20 ` Junio C Hamano
[not found] ` <CALeToSVPWPwJTYxRgy0BW4TBfBJrb+LXC+QJDWjceQ=4f2_tRw@mail.gmail.com>
[not found] ` <CALeToSV6xx=Vfw8gRbmeKWDzcHFaYvgFhMqx5cwtCYKdASJptw@mail.gmail.com>
2012-03-11 21:13 ` Frédéric Heitzmann
2012-03-10 14:11 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALeToSUaPzdr=u7FfwHEtEanphVP5LZ09QdQXno52PLBTK0H-g@mail.gmail.com' \
--to=frederic.heitzmann@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).