All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
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:07:34 -0400	[thread overview]
Message-ID: <20070722070734.GU32566@spearce.org> (raw)
In-Reply-To: <6b6419750707212355q48a934e4n3be0d6111694ad01@mail.gmail.com>

Patrick Aljord <patcito@gmail.com> wrote:
> I would like to check it from another direcory, I tried the following 
> command:
> 
> $ git --git-dir=/path/to/my_git_dir status
> 
> and
> 
> $ GIT_DIR='/path/to/my_git_dir' && git status

These are actually the same two commands.  The --git-dir option
just means "set GIT_DIR before calling the real command".

However, there are two problems here...
 
> but in both cases I get this error:
> fatal: Not a git repository: '/path/to/my_git_dir'

Right.  That's problem number 1.  /path/to/my_git_dir is probably
not actually your Git repository.  The git repository is actually in
".git", so you really need to use:

  $ git --git-dir=/path/to/my_git_dir/.git status

However, problem number 2 is that status requires a working
directory.  Setting GIT_DIR explicitly like this tells git that
you don't have a working directory present.  So status won't work.

> yet when I do "$ cd /path/to/my_git_dir && git status" I do get the results.

That's what you have to do if you want to run git-status.  Or use
a subshell as that won't change your current working directory:

  $ (cd /path/to/my_git_dir && git status)

-- 
Shawn.

  reply	other threads:[~2007-07-22  7:07 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 [this message]
2007-07-22  7:11 ` Jeff King
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=20070722070734.GU32566@spearce.org \
    --to=spearce@spearce.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.