# git status resets permissions on index file -- Ubuntu 12.04 64b

11 messages from 2013-08-08 to 2013-08-09. Participants: Justin Collum, Stefan Beller, Andrew Ruder, Kyle J. McKay, Andreas Schwab, Matthieu Moy.
Thread: https://gitlist.dev/t/34646

## Justin Collum, 2013-08-08 20:27

Subject: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <CACO0oR7a1-fUASQ+SJVbH1CU8d=NbHrK0MuMu+9Pr4_=7q85Vw@mail.gmail.com>
URL: https://gitlist.dev/e/CACO0oR7a1-fUASQ%2BSJVbH1CU8d%3DNbHrK0MuMu%2B9Pr4_%3D7q85Vw%40mail.gmail.com

```
I've run into a strange situation with git lately. It seems that
anything I do involving git will alter the permissions on my index
file to the point that I can't do anything until I re-add the
permissions on the file.

Looks like a bug to me, is it? It does seem like this has started
happening since I moved over to 64b Ubuntu.

$ ll .git
total 156K
...
drwxrwxrwx   2 dev dev 4.0K Jul 23 09:30 hooks
-rwxrwxrwx   1 dev dev  17K Aug  8 13:12 index
drwxrwxrwx   2 dev dev 4.0K Jul 19 09:31 info
...

$ gs
# On branch build-0.3
# Your branch is ahead of 'staging/build-0.3' by 5 commits.
#   (use "git push" to publish your local commits)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# scripts/loadMongo.coffee
nothing added to commit but untracked files present (use "git add" to track)

$ ll .git
total 156K
...
drwxrwxrwx   2 dev dev 4.0K Jul 23 09:30 hooks
-rw-rw-r--   1 dev dev  17K Aug  8 13:16 index   # <---------------
this line  <-------------------------------
drwxrwxrwx   2 dev dev 4.0K Jul 19 09:31 info
...

$ git --version
git version 1.8.3.4

Ubuntu:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise

```

## Stefan Beller, 2013-08-08 21:35

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <52040F27.4050908@googlemail.com>
URL: https://gitlist.dev/e/52040F27.4050908%40googlemail.com
In-Reply-To: <CACO0oR7a1-fUASQ+SJVbH1CU8d=NbHrK0MuMu+9Pr4_=7q85Vw@mail.gmail.com>

```
On 08/08/2013 10:27 PM, Justin Collum wrote:
> I've run into a strange situation with git lately. It seems that
> anything I do involving git will alter the permissions on my index
> file to the point that I can't do anything until I re-add the
> permissions on the file.
> 
> Looks like a bug to me, is it? It does seem like this has started
> happening since I moved over to 64b Ubuntu.
> 
> $ ll .git
> total 156K
> ...
> drwxrwxrwx   2 dev dev 4.0K Jul 23 09:30 hooks
> -rwxrwxrwx   1 dev dev  17K Aug  8 13:12 index
> drwxrwxrwx   2 dev dev 4.0K Jul 19 09:31 info
> ...
> 
> $ gs
> # On branch build-0.3
> # Your branch is ahead of 'staging/build-0.3' by 5 commits.
> #   (use "git push" to publish your local commits)
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> # scripts/loadMongo.coffee
> nothing added to commit but untracked files present (use "git add" to track)
> 
> $ ll .git
> total 156K
> ...
> drwxrwxrwx   2 dev dev 4.0K Jul 23 09:30 hooks
> -rw-rw-r--   1 dev dev  17K Aug  8 13:16 index   # <---------------
> this line  <-------------------------------
> drwxrwxrwx   2 dev dev 4.0K Jul 19 09:31 info
> ...
> 
> $ git --version
> git version 1.8.3.4
> 
> Ubuntu:
> Distributor ID: Ubuntu
> Description: Ubuntu 12.04.2 LTS
> Release: 12.04
> Codename: precise

The permissions are set to reading for all and writing for you(r user)
and your group. This should be no problem with standard git commands.
Before you had the index file executable, why would you need that?

What kind of filesystem do you have? (The output of 'mount' would be 
interesting) 

Also what exactly breaks? ("can't do anything") 
What commands do not behave as you'd expect? 

Stefan


```

## Andrew Ruder, 2013-08-08 22:18

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <20130808221807.GA8518@gmail.com>
URL: https://gitlist.dev/e/20130808221807.GA8518%40gmail.com
In-Reply-To: <52040F27.4050908@googlemail.com>

```
On Thu, Aug 08, 2013 at 11:35:35PM +0200, Stefan Beller wrote:
> On 08/08/2013 10:27 PM, Justin Collum wrote:
> > [...]
> > -rwxrwxrwx   1 dev dev  17K Aug  8 13:12 index
> > [...]
> > -rw-rw-r--   1 dev dev  17K Aug  8 13:16 index   # <---------------
> 
> The permissions are set to reading for all and writing for you(r user)
> and your group. This should be no problem with standard git commands.
> Before you had the index file executable, why would you need that?

I'm about 90% sure the issue he's having is that the write bit for
other/world goes away and he is neither the user dev or the group dev
and the reason for all the executable bits is that he is regularly
running

    chmod -R 777 .

Justin, if this is true, I will tell you that git respects your umask
but I just can't bring myself to really suggest someone type umask 000
ever. :(

- Andy

```

## Justin Collum, 2013-08-08 22:33

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <CACO0oR7M90iyDCo-mwoHn21jKRGuMsRWEeWkFXC-MCSUBscC9w@mail.gmail.com>
URL: https://gitlist.dev/e/CACO0oR7M90iyDCo-mwoHn21jKRGuMsRWEeWkFXC-MCSUBscC9w%40mail.gmail.com
In-Reply-To: <20130808221807.GA8518@gmail.com>

```
On Thu, Aug 8, 2013 at 3:18 PM, Andrew Ruder <andy@aeruder.net> wrote:
> he is neither the user dev or the group dev

I am both. There's only one user on this machine and he is me.

> he is regularly running  chmod -R 777

Yes, true. I have a program that I use to edit some of these files
(not the git files) that likes to screw up permissions. It's a long
story. Anyway, I've been running that chmod regularly since well
before this git issue started. I'll start using 644 for the chmod and
see if that helps.

```

## Kyle J. McKay, 2013-08-08 22:37

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <C525FA0D-D22C-4C78-8C97-45819FD58DD7@gmail.com>
URL: https://gitlist.dev/e/C525FA0D-D22C-4C78-8C97-45819FD58DD7%40gmail.com
In-Reply-To: <20130808221807.GA8518@gmail.com>

```
On Aug 8, 2013, at 15:18, Andrew Ruder wrote:
> On Thu, Aug 08, 2013 at 11:35:35PM +0200, Stefan Beller wrote:
>> On 08/08/2013 10:27 PM, Justin Collum wrote:
>>> [...]
>>> -rwxrwxrwx   1 dev dev  17K Aug  8 13:12 index
>>> [...]
>>> -rw-rw-r--   1 dev dev  17K Aug  8 13:16 index   # <---------------
>>
>> The permissions are set to reading for all and writing for you(r  
>> user)
>> and your group. This should be no problem with standard git commands.
>> Before you had the index file executable, why would you need that?
>
> I'm about 90% sure the issue he's having is that the write bit for
> other/world goes away and he is neither the user dev or the group dev
> and the reason for all the executable bits is that he is regularly
> running
>
>    chmod -R 777 .
>
> Justin, if this is true, I will tell you that git respects your umask
> but I just can't bring myself to really suggest someone type umask 000
> ever. :(


Justin,

If you really want a repository that's writable by everyone, why not  
just do "git config core.sharedRepository 0666" ?

If you just want them to be group-writable you may be happier with  
"git config core.sharedRepository true" or possibly "git config  
core.sharedRepository all".  The setting is described fully in "git  
help config".

```

## Andrew Ruder, 2013-08-08 23:00

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <20130808230058.GA10058@gmail.com>
URL: https://gitlist.dev/e/20130808230058.GA10058%40gmail.com
In-Reply-To: <CACO0oR7M90iyDCo-mwoHn21jKRGuMsRWEeWkFXC-MCSUBscC9w@mail.gmail.com>

```
On Thu, Aug 08, 2013 at 03:33:32PM -0700, Justin Collum wrote:
> On Thu, Aug 8, 2013 at 3:18 PM, Andrew Ruder <andy@aeruder.net> wrote:
> > he is neither the user dev or the group dev
> 
> I am both. There's only one user on this machine and he is me.

If you are running as 'dev', then I'm not sure how the permissions in
the modified case would affect git's ability to work with the file.
Seems like everything should be working fine... what is the error you
get when things stop working?

```

## Justin Collum, 2013-08-08 23:58

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <CACO0oR7tJNKWA=cynBA8R2kaGr2iKNCiCmXKLur9nub6pnBG0g@mail.gmail.com>
URL: https://gitlist.dev/e/CACO0oR7tJNKWA%3DcynBA8R2kaGr2iKNCiCmXKLur9nub6pnBG0g%40mail.gmail.com
In-Reply-To: <C525FA0D-D22C-4C78-8C97-45819FD58DD7@gmail.com>

```
doing

     sudo chmod 644 ./.git/index

instead of 777 resulted in the same result a bit later:

    $ gs
    fatal: index file open failed: Permission denied


On Thu, Aug 8, 2013 at 3:37 PM, Kyle J. McKay <mackyle@gmail.com> wrote:
> On Aug 8, 2013, at 15:18, Andrew Ruder wrote:
>>
>> On Thu, Aug 08, 2013 at 11:35:35PM +0200, Stefan Beller wrote:
>>>
>>> On 08/08/2013 10:27 PM, Justin Collum wrote:
>>>>
>>>> [...]
>>>> -rwxrwxrwx   1 dev dev  17K Aug  8 13:12 index
>>>> [...]
>>>> -rw-rw-r--   1 dev dev  17K Aug  8 13:16 index   # <---------------
>>>
>>>
>>> The permissions are set to reading for all and writing for you(r user)
>>> and your group. This should be no problem with standard git commands.
>>> Before you had the index file executable, why would you need that?
>>
>>
>> I'm about 90% sure the issue he's having is that the write bit for
>> other/world goes away and he is neither the user dev or the group dev
>> and the reason for all the executable bits is that he is regularly
>> running
>>
>>    chmod -R 777 .
>>
>> Justin, if this is true, I will tell you that git respects your umask
>> but I just can't bring myself to really suggest someone type umask 000
>> ever. :(
>
>
>
> Justin,
>
> If you really want a repository that's writable by everyone, why not just do
> "git config core.sharedRepository 0666" ?
>
> If you just want them to be group-writable you may be happier with "git
> config core.sharedRepository true" or possibly "git config
> core.sharedRepository all".  The setting is described fully in "git help
> config".

```

## Andreas Schwab, 2013-08-09 12:40

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <8761vf3uml.fsf@igel.home>
URL: https://gitlist.dev/e/8761vf3uml.fsf%40igel.home
In-Reply-To: <CACO0oR7tJNKWA=cynBA8R2kaGr2iKNCiCmXKLur9nub6pnBG0g@mail.gmail.com>

```
Justin Collum <jcollum@gmail.com> writes:

>      sudo chmod 644 ./.git/index

That doesn't make sense.  If you are the owner of the file, why do you
need sudo???

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Matthieu Moy, 2013-08-09 12:58

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <vpqa9krja1f.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqa9krja1f.fsf%40anie.imag.fr
In-Reply-To: <8761vf3uml.fsf@igel.home>

```
Andreas Schwab <schwab@linux-m68k.org> writes:

> Justin Collum <jcollum@gmail.com> writes:
>
>>      sudo chmod 644 ./.git/index
>
> That doesn't make sense.  If you are the owner of the file, why do you
> need sudo???

I suspect that some over-use of "sudo" resulted in files or directories
belonging to root. What does

  find . -user 0

say?

(As a developer, you should never need sudo. You should only need in as
an administrator of your machine.)

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

```

## Justin Collum, 2013-08-09 17:00

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <CACO0oR4_+=6iimO4U0rt2JuhfxrX1CkjWR5iMkt=+EuxscmBMg@mail.gmail.com>
URL: https://gitlist.dev/e/CACO0oR4_%2B%3D6iimO4U0rt2JuhfxrX1CkjWR5iMkt%3D%2BEuxscmBMg%40mail.gmail.com
In-Reply-To: <8761vf3uml.fsf@igel.home>

```
> That doesn't make sense.  If you are the owner of the file, why do you need sudo???

I've just never seen a chmod command without sudo. I assumed it was
needed. Is this relevant to the bug that I'm seeing?

On Fri, Aug 9, 2013 at 5:40 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Justin Collum <jcollum@gmail.com> writes:
>
>>      sudo chmod 644 ./.git/index
>
> That doesn't make sense.  If you are the owner of the file, why do you
> need sudo???
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

```

## Justin Collum, 2013-08-09 19:29

Subject: Re: git status resets permissions on index file -- Ubuntu 12.04 64b
Message-ID: <CACO0oR7Kx0auNV6GRwqr-OdtnrCW21LxiMFrNUDRGRJN+P6ebg@mail.gmail.com>
URL: https://gitlist.dev/e/CACO0oR7Kx0auNV6GRwqr-OdtnrCW21LxiMFrNUDRGRJN%2BP6ebg%40mail.gmail.com
In-Reply-To: <CACO0oR4_+=6iimO4U0rt2JuhfxrX1CkjWR5iMkt=+EuxscmBMg@mail.gmail.com>

```
I've looked into this a bit and I think this is a bug in Webstorm.
Webstorm saves files a lot without you actually hitting save, so
that's why I didn't put 2 and 2 together. It appears that any file
change in Webstorm is screwing up the permissions on git's index --
but only in 64b Ubuntu, it wasn't happening in 32b.

On Fri, Aug 9, 2013 at 10:00 AM, Justin Collum <jcollum@gmail.com> wrote:
>> That doesn't make sense.  If you are the owner of the file, why do you need sudo???
>
> I've just never seen a chmod command without sudo. I assumed it was
> needed. Is this relevant to the bug that I'm seeing?
>
> On Fri, Aug 9, 2013 at 5:40 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Justin Collum <jcollum@gmail.com> writes:
>>
>>>      sudo chmod 644 ./.git/index
>>
>> That doesn't make sense.  If you are the owner of the file, why do you
>> need sudo???
>>
>> Andreas.
>>
>> --
>> Andreas Schwab, schwab@linux-m68k.org
>> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
>> "And now for something completely different."

```
