Re: executing git from a non git directory

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

 



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
-
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]

  Powered by Linux