From: Jeff King <peff@peff.net>
To: Patrick Aljord <patcito@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: executing git from a non git directory
Date: Sun, 22 Jul 2007 03:11:37 -0400 [thread overview]
Message-ID: <20070722071136.GA346@coredump.intra.peff.net> (raw)
In-Reply-To: <6b6419750707212355q48a934e4n3be0d6111694ad01@mail.gmail.com>
On Sun, Jul 22, 2007 at 01:55:33AM -0500, Patrick Aljord wrote:
> $ git --git-dir=/path/to/my_git_dir status
>
> and
>
> $ GIT_DIR='/path/to/my_git_dir' && git status
>
> but in both cases I get this error:
> fatal: Not a git repository: '/path/to/my_git_dir'
A git dir is the location where all of the repository information is
stored; it is called '.git' for a directory with a working tree. Is
/path/to/my_git_dir really a git dir, or is it a working directory that
has a '.git' inside it?
If the latter, then you need to specify the .git directory. However,
running 'git-status' won't make any sense then, since you won't be in
the correct working tree (so of course it will look like files have been
removed).
You could do something like "git --dir /path/to/my_git_dir/.git branch"
and it would at least produce sensible results.
> yet when I do "$ cd /path/to/my_git_dir && git status" I do get the results.
Right. That's the way you have to do it in the case of 'status', since
you need your current working directory to be in the right place.
If you are running a very recent git, you can now try:
git --work-tree=/path/to/my_git_dir --git-dir=/path/to/my_git_dir/.git status
which is what you actually want.
-Peff
next prev parent reply other threads:[~2007-07-22 7:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-22 6:55 executing git from a non git directory Patrick Aljord
2007-07-22 7:07 ` Shawn O. Pearce
2007-07-22 7:11 ` Jeff King [this message]
2007-07-22 19:02 ` Patrick Aljord
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=20070722071136.GA346@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=patcito@gmail.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).