# Git: "No you can't handle my root!" (?)

18 messages from 2009-10-12 to 2009-10-15. Participants: sylvain@demarque.qc.ca, Steven Noonan, Alex Riesen, Markus Heidelberg, Jeff King, Matthieu Moy, Daniele Segato, Avery Pennarun, Tony Finch, Wesley J. Landaker.
Thread: https://gitlist.dev/t/21204

## sylvain@demarque.qc.ca, 2009-10-12 05:28

Subject: Git: "No you can't handle my root!" (?)
Message-ID: <20091012012826.7sffggwmm8sk0cc8@webmail.demarque.qc.ca>
URL: https://gitlist.dev/e/20091012012826.7sffggwmm8sk0cc8%40webmail.demarque.qc.ca

```
Git is good, Git is great! All praise the Git! :-D

What do you people think about this strange phenomena?

localhost / # git --version
git version 1.6.4.4

localhost / # git init
Initialized empty Git repository in //.git/

localhost / # cd etc
localhost etc # git add X11/xorg.conf
fatal: pathspec 'etc/X11/xorg.conf' did not match any files

Aside from the obvious question of why would I want to Git the whole
tree ("But all files deserve the Holy Presence of the Git!"), why does
Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because
it contains font directory configurations?

Commit and [ENTER] to all,

S! :-)

```

## sylvain@demarque.qc.ca, 2009-10-12 17:59

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091012135910.ujqifycf9cwsk4ss@webmail.demarque.qc.ca>
URL: https://gitlist.dev/e/20091012135910.ujqifycf9cwsk4ss%40webmail.demarque.qc.ca
In-Reply-To: <20091012012826.7sffggwmm8sk0cc8@webmail.demarque.qc.ca>

```
Hello there. I know I was being goofy, but here is the real down to  
earth question :

Is there a known bug/feature that prevents Git from being used at "/"?  
It seems that there is a problem either at "git init" or "git add"  
when the repository is located at "/.git". (Git 1.6.4.4, see example  
below)

Thank you!

Quoting sylvain@demarque.qc.ca:

> Git is good, Git is great! All praise the Git! :-D
>
> What do you people think about this strange phenomena?
>
> localhost / # git --version
> git version 1.6.4.4
>
> localhost / # git init
> Initialized empty Git repository in //.git/
>
> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files
>
> Aside from the obvious question of why would I want to Git the whole
> tree ("But all files deserve the Holy Presence of the Git!"), why does
> Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because
> it contains font directory configurations?
>
> Commit and [ENTER] to all,
>
> S! :-)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Steven Noonan, 2009-10-12 18:06

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <f488382f0910121106h64571b93jb92372a1d7720b10@mail.gmail.com>
URL: https://gitlist.dev/e/f488382f0910121106h64571b93jb92372a1d7720b10%40mail.gmail.com
In-Reply-To: <20091012135910.ujqifycf9cwsk4ss@webmail.demarque.qc.ca>

```
I've had this problem too, but I eventually realized it was git's way
of telling me I shouldn't do that. But even so, it'd be good if we
_could_.

- Steven

On Mon, Oct 12, 2009 at 10:59 AM,  <sylvain@demarque.qc.ca> wrote:
> Hello there. I know I was being goofy, but here is the real down to
> earth question :
>
> Is there a known bug/feature that prevents Git from being used at "/"?
> It seems that there is a problem either at "git init" or "git add"
> when the repository is located at "/.git". (Git 1.6.4.4, see example
> below)
>
> Thank you!
>
> Quoting sylvain@demarque.qc.ca:
>
>> Git is good, Git is great! All praise the Git! :-D
>>
>> What do you people think about this strange phenomena?
>>
>> localhost / # git --version
>> git version 1.6.4.4
>>
>> localhost / # git init
>> Initialized empty Git repository in //.git/
>>
>> localhost / # cd etc
>> localhost etc # git add X11/xorg.conf
>> fatal: pathspec 'etc/X11/xorg.conf' did not match any files
>>
>> Aside from the obvious question of why would I want to Git the whole
>> tree ("But all files deserve the Holy Presence of the Git!"), why does
>> Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because
>> it contains font directory configurations?
>>
>> Commit and [ENTER] to all,
>>
>> S! :-)
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

```

## Alex Riesen, 2009-10-12 18:15

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <81b0412b0910121115s26c6c08s1ea54c28851faf05@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0910121115s26c6c08s1ea54c28851faf05%40mail.gmail.com
In-Reply-To: <f488382f0910121106h64571b93jb92372a1d7720b10@mail.gmail.com>

```
On Mon, Oct 12, 2009 at 20:06, Steven Noonan <steven@uplinklabs.net> wrote:
> I've had this problem too, but I eventually realized it was git's way
> of telling me I shouldn't do that. But even so, it'd be good if we
> _could_.

It's more of "a note to the future generation of developers": "Hey guys,
we didn't need that working, but if you have a night to spare could you
please finish that?"

```

## sylvain@demarque.qc.ca, 2009-10-12 18:20

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091012142017.vrs4v2cc8wgws8g4@webmail.demarque.qc.ca>
URL: https://gitlist.dev/e/20091012142017.vrs4v2cc8wgws8g4%40webmail.demarque.qc.ca
In-Reply-To: <81b0412b0910121115s26c6c08s1ea54c28851faf05@mail.gmail.com>

```
Quoting Alex Riesen <raa.lkml@gmail.com>:

> On Mon, Oct 12, 2009 at 20:06, Steven Noonan <steven@uplinklabs.net> wrote:
>> I've had this problem too, but I eventually realized it was git's way
>> of telling me I shouldn't do that. But even so, it'd be good if we
>> _could_.
>
> It's more of "a note to the future generation of developers": "Hey guys,
> we didn't need that working, but if you have a night to spare could you
> please finish that?"

Ok, then I won't wait for it to work. I will dive in Git's code and  
play the "future generation of developers" part... some day. ;-)

Thank you! :-)

```

## Markus Heidelberg, 2009-10-12 18:30

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <200910122030.08179.markus.heidelberg@web.de>
URL: https://gitlist.dev/e/200910122030.08179.markus.heidelberg%40web.de
In-Reply-To: <20091012012826.7sffggwmm8sk0cc8@webmail.demarque.qc.ca>

```
sylvain@demarque.qc.ca, 12.10.2009:
> Git is good, Git is great! All praise the Git! :-D
> 
> What do you people think about this strange phenomena?
> 
> localhost / # git --version
> git version 1.6.4.4
> 
> localhost / # git init
> Initialized empty Git repository in //.git/
> 
> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files

"git add etc/X11/xorg.conf" works, seems to be a bug.

Markus

```

## Alex Riesen, 2009-10-12 18:30

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <81b0412b0910121130l488ab4beycc405ceafa7d6260@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0910121130l488ab4beycc405ceafa7d6260%40mail.gmail.com
In-Reply-To: <20091012142017.vrs4v2cc8wgws8g4@webmail.demarque.qc.ca>

```
On Mon, Oct 12, 2009 at 20:20,  <sylvain@demarque.qc.ca> wrote:
> Quoting Alex Riesen <raa.lkml@gmail.com>:
>> It's more of "a note to the future generation of developers": "Hey guys,
>> we didn't need that working, but if you have a night to spare could you
>> please finish that?"
>
> Ok, then I won't wait for it to work. I will dive in Git's code and play the
> "future generation of developers" part... some day. ;-)
>
> Thank you! :-)
>

Hmm... This strategy to encourage new contributors didn't quite worked out.
Must try something else next time. Do you like sweets? Just asking...

```

## Jeff King, 2009-10-12 18:35

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091012183519.GA10686@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20091012183519.GA10686%40coredump.intra.peff.net
In-Reply-To: <20091012142017.vrs4v2cc8wgws8g4@webmail.demarque.qc.ca>

```
On Mon, Oct 12, 2009 at 02:20:17PM -0400, sylvain@demarque.qc.ca wrote:

> >It's more of "a note to the future generation of developers": "Hey guys,
> >we didn't need that working, but if you have a night to spare could you
> >please finish that?"
> 
> Ok, then I won't wait for it to work. I will dive in Git's code and
> play the "future generation of developers" part... some day. ;-)
> 
> Thank you! :-)

I think that it sort of works, actually. It seems to do OK if you do
something like:

  $ GIT_DIR=/path/to/store/repo; export GIT_DIR
  $ GIT_WORK_TREE=/; export GIT_WORK_TREE
  $ git init
  $ cd /etc/whatever
  $ git add .

But it does not work if you try to make things work automatically:

  $ cd /
  $ git init
  $ cd /etc/whatever
  $ git add .

So probably the bug is in detecting the location of the work tree when
it is not explicitly given. You can use the explicit style as a
workaround for now.

-Peff

```

## Matthieu Moy, 2009-10-12 19:02

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <vpqfx9oxwpb.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqfx9oxwpb.fsf%40bauges.imag.fr
In-Reply-To: <20091012012826.7sffggwmm8sk0cc8@webmail.demarque.qc.ca>

```
sylvain@demarque.qc.ca writes:

> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files

cd ..
git add etc/X11/xorg.conf

works. I don't know why the other doesn't (just tested adding from an
untracked directory in another project, it does work).

If you want to version a large directory like /, I'd advise putting
"*" in /.gitignore to make sure Git never tries to traverse the whole
filesystem.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## sylvain@demarque.qc.ca, 2009-10-12 19:08

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091012150826.p1v0gnnvokg0oggg@webmail.demarque.qc.ca>
URL: https://gitlist.dev/e/20091012150826.p1v0gnnvokg0oggg%40webmail.demarque.qc.ca
In-Reply-To: <20091012183519.GA10686@coredump.intra.peff.net>

```
Quoting Jeff King <peff@peff.net>:

> On Mon, Oct 12, 2009 at 02:20:17PM -0400, sylvain@demarque.qc.ca wrote:
>
> I think that it sort of works, actually. It seems to do OK if you do
> something like:
>
>   $ GIT_DIR=/path/to/store/repo; export GIT_DIR
>   $ GIT_WORK_TREE=/; export GIT_WORK_TREE
>   $ git init
>   $ cd /etc/whatever
>   $ git add .
>
> So probably the bug is in detecting the location of the work tree when
> it is not explicitly given. You can use the explicit style as a
> workaround for now.
>
> -Peff

Thank you! Great idea!

export GIT_DIR=/root/.git
export GIT_WORK_TREE=/
echo "*" >> /root/.git/info/exclude

The Golden Solution of the Gods! :-D

```

## Daniele Segato, 2009-10-12 21:37

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <1255383459.15646.10.camel@localhost>
URL: https://gitlist.dev/e/1255383459.15646.10.camel%40localhost
In-Reply-To: <20091012012826.7sffggwmm8sk0cc8@webmail.demarque.qc.ca>

```
Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha
scritto:
> localhost / # git init


I don't see the point of using git on the root directory :)

but that made me think that it could actually be a good idea
for /etc/ :)
I happen to modify some configuration and then I forgot which one... and
sometimes updates broke something


And that make me think of another question...

is there a way to have a git repo for a subset of directory that match a
pattern?

for instance...

can I have a git report of $HOME/.* (without . and ..)? (all user
setting)

Or better: provide a list of directory under $HOME I want to track 

Instead of providing the list of directory I want to ignore i would like
to provide the list of the directory and files I want to track :)

I probably am going out of topic here but I hope you forgive me :)

```

## Avery Pennarun, 2009-10-12 21:57

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <32541b130910121457x632fc8b1xc58eca9d8b646500@mail.gmail.com>
URL: https://gitlist.dev/e/32541b130910121457x632fc8b1xc58eca9d8b646500%40mail.gmail.com
In-Reply-To: <1255383459.15646.10.camel@localhost>

```
On Mon, Oct 12, 2009 at 5:37 PM, Daniele Segato <daniele.bilug@gmail.com> wrote:
> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)
>
> Or better: provide a list of directory under $HOME I want to track
>
> Instead of providing the list of directory I want to ignore i would like
> to provide the list of the directory and files I want to track :)

You can probably do pretty much anything you want by twiddling with
options in .gitignore.  You should be able to add "don't ignore" names
by starting them with !, iirc.

Avery

```

## sylvain@demarque.qc.ca, 2009-10-12 22:04

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091012180420.8r1px9z7ggs8kksc@webmail.demarque.qc.ca>
URL: https://gitlist.dev/e/20091012180420.8r1px9z7ggs8kksc%40webmail.demarque.qc.ca
In-Reply-To: <1255383459.15646.10.camel@localhost>

```
Quoting Daniele Segato <daniele.bilug@gmail.com>:

> Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha
> scritto:
>> localhost / # git init
>
> I don't see the point of using git on the root directory :)
>
> but that made me think that it could actually be a good idea
> for /etc/ :)
> I happen to modify some configuration and then I forgot which one... and
> sometimes updates broke something
>
>
> And that make me think of another question...
>
> is there a way to have a git repo for a subset of directory that match a
> pattern?
>
> for instance...
>
> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)
>
> Or better: provide a list of directory under $HOME I want to track
>
> Instead of providing the list of directory I want to ignore i would like
> to provide the list of the directory and files I want to track :)
>
> I probably am going out of topic here but I hope you forgive me :)

I am still a Git newbee, but I am using GNU/Linux for a long time now.  
I have just reformatted my disk and installed Gentoo and I have to  
setup all these little things all over again. Since I clean install  
only every couple of years, I often forget some details, etc.

So I am trying something new. I have my "home Git" at "~/.git" and the  
"root Git" at "/root/.git" with the GIT_WORK_TREE at "/". Both have  
"*" in "info/exclude", so I do provide my list of directories and  
files I want to track explicitly by adding them one by one.

My home Git takes care of .bash* .vim* .emacs*, firefox passwords and  
bookmarks, etc. My root git takes care of some "/etc", "/var" configs,  
etc. (That is the reason why I wanted it on "/", because some  
configuration tweaks are done outside of "/etc". Oh, I forgot to  
mention "/usr/src/linux/.config")

My hope is that next time I'll clean install my system, I won't have  
to backup my whole disk and then mount it again to recover configs  
pieces by pieces. I'll just copy my two Git repositories and I'll  
should be OK.

All praise the Git. :-)

```

## Jeff King, 2009-10-13 01:43

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091013014332.GB13737@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20091013014332.GB13737%40coredump.intra.peff.net
In-Reply-To: <1255383459.15646.10.camel@localhost>

```
On Mon, Oct 12, 2009 at 11:37:39PM +0200, Daniele Segato wrote:

> I don't see the point of using git on the root directory :)
> 
> but that made me think that it could actually be a good idea
> for /etc/ :)
> I happen to modify some configuration and then I forgot which one... and
> sometimes updates broke something

Take a look at:

  http://joey.kitenet.net/code/etckeeper/

> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)

This seems to work:

  $ cd ~
  $ git init
  $ echo '*' >.gitignore
  $ echo '!.*' >.gitignore

> Or better: provide a list of directory under $HOME I want to track 

Same thing, but make your ! pattern more specific.

-Peff

```

## Daniele Segato, 2009-10-13 04:17

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <1255407433.15646.12.camel@localhost>
URL: https://gitlist.dev/e/1255407433.15646.12.camel%40localhost
In-Reply-To: <20091013014332.GB13737@coredump.intra.peff.net>

```
Il giorno lun, 12/10/2009 alle 21.43 -0400, Jeff King ha scritto:
> Take a look at:
> 
>   http://joey.kitenet.net/code/etckeeper/


thanks really interesting


> > can I have a git report of $HOME/.* (without . and ..)? (all user
> > setting)
> 
> This seems to work:
> 
>   $ cd ~
>   $ git init
>   $ echo '*' >.gitignore
>   $ echo '!.*' >.gitignore
> 
> > Or better: provide a list of directory under $HOME I want to track 
> 
> Same thing, but make your ! pattern more specific.

thanks again!

regards,
Daniele

```

## Jeff King, 2009-10-13 05:01

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <20091013050149.GA11317@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20091013050149.GA11317%40sigill.intra.peff.net
In-Reply-To: <1255407433.15646.12.camel@localhost>

```
On Tue, Oct 13, 2009 at 06:17:13AM +0200, Daniele Segato wrote:

> > This seems to work:
> > 
> >   $ cd ~
> >   $ git init
> >   $ echo '*' >.gitignore
> >   $ echo '!.*' >.gitignore
> > 
> > > Or better: provide a list of directory under $HOME I want to track 
> > 
> > Same thing, but make your ! pattern more specific.
> 
> thanks again!

You're welcome, though while reading the quoted text I noticed a typo in
my instructions. The second echo should obviously be _appending_ to
.gitignore:

  $ echo '!.*' >>.gitignore

Hopefully that was obvious, but I thought I would point it out for the
record.

-Peff

```

## Tony Finch, 2009-10-13 17:46

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <alpine.LSU.2.00.0910131842440.11815@hermes-1.csi.cam.ac.uk>
URL: https://gitlist.dev/e/alpine.LSU.2.00.0910131842440.11815%40hermes-1.csi.cam.ac.uk
In-Reply-To: <20091012183519.GA10686@coredump.intra.peff.net>

```
On Mon, 12 Oct 2009, Jeff King wrote:
>
>   $ cd /
>   $ git init
>   $ cd /etc/whatever
>   $ git add .

One reason that you don't want to do this (even if it does work) is that
careless use of git (e.g. by a user who is not the sysadmin playing with
git in their home directory) is going to find the root repository when you
expect it not to find any repository.

Also, I suggest this little wrapper script:
http://dotat.at/cgi/git?p=git-deploy.git;a=blob;f=git-root.sh

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.

```

## Wesley J. Landaker, 2009-10-15 03:02

Subject: Re: Git: "No you can't handle my root!" (?)
Message-ID: <200910142102.39920.wjl@icecavern.net>
URL: https://gitlist.dev/e/200910142102.39920.wjl%40icecavern.net
In-Reply-To: <1255383459.15646.10.camel@localhost>

```
On Monday 12 October 2009 15:37:39 Daniele Segato wrote:
> Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha
>
> scritto:
> > localhost / # git init
>
> I don't see the point of using git on the root directory :)

Just a comment: this might be of serious use in e.g. a chroot.

```
