git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ron Garret <ron1@flownet.com>
Cc: git@vger.kernel.org
Subject: Re: GIT_WORK_TREE environment variable not working
Date: Mon, 1 Feb 2010 00:19:42 -0500	[thread overview]
Message-ID: <20100201051942.GA7761@coredump.intra.peff.net> (raw)
In-Reply-To: <ron1-8E7697.17334731012010@news.gmane.org>

On Sun, Jan 31, 2010 at 05:33:47PM -0800, Ron Garret wrote:

> What am I doing wrong here?
> 
> [ron@mickey:~/devel/gittest]$ pwd
> /Users/ron/devel/gittest
> [ron@mickey:~/devel/gittest]$ git status
> # On branch master
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #  git/
> nothing added to commit but untracked files present (use "git add" to 
> track)
> [ron@mickey:~/devel/gittest]$ cd
> [ron@mickey:~]$ export GIT_WORK_TREE=/Users/ron/devel/gittest
> [ron@mickey:~]$ git status
> fatal: Not a git repository (or any of the parent directories): .git
> [ron@mickey:~]$ git status --work-tree=/Users/ron/devel/gittest
> fatal: Not a git repository (or any of the parent directories): .git
> [ron@mickey:~]$

You haven't told git where to find the repository itself. GIT_WORK_TREE
is about saying "here are my work tree files", but it is explicitly not
about "here is where my .git directory is". That lets you keep the two
in totally separate locations. E.g., you could do something like
tracking /etc, but keep your .git directory in /var.

For your case above, you would want to also

  export GIT_DIR=/Users/ron/devel/gittest/.git

though since you have a fully formed repository, I don't think there is
really any advantage over just doing:

  cd /Users/ron/devel/gittest && git $whatever

though perhaps that is because this is not a real use case, but rather
just you trying to figure out the feature. :)

-Peff

  reply	other threads:[~2010-02-01  5:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01  1:33 GIT_WORK_TREE environment variable not working Ron Garret
2010-02-01  5:19 ` Jeff King [this message]
2010-02-01  7:09   ` Ron Garret

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=20100201051942.GA7761@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=ron1@flownet.com \
    /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).