# git-shell vs "detected dubious ownership in repository"

2 messages from 2024-05-21 to 2024-05-27. Participants: Harald Dunkel, Carlisle T. Hamlin.
Thread: https://gitlist.dev/t/61523

## Harald Dunkel, 2024-05-21 08:40

Subject: git-shell vs "detected dubious ownership in repository"
Message-ID: <14ed85d8-dccb-4928-a4b8-a099d151fe5b@aixigo.com>
URL: https://gitlist.dev/e/14ed85d8-dccb-4928-a4b8-a099d151fe5b%40aixigo.com

```
Hi folks,

since 2.45.1 (upgraded from 2.40.something) I cannot pull my
etckeeper repositories anymore:

	# su - etckeeper
	% cd /archive/host.example.com
	% git remote -v
	origin  host.example.com:/etc (fetch)
	origin  host.example.com:/etc (push)
	% git pull
	fatal: detected dubious ownership in repository at '/etc/.git'
	To add an exception for this directory, call:
	
	        git config --global --add safe.directory /etc/.git
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.

Please note there is git-shell on the remote side. Question is,
what is dubious about the existing access bits of the remote repo?
Currently I have

	root@host.example.com:/etc/.git# ls -al
	total 532
	drwxr-s---   8 root etckeeper   4096 May 21 10:14 .
	drwxr-xr-x 242 root root       20480 May 18 06:28 ..
	-rw-r-s---   1 root etckeeper   2716 May 17 14:04 COMMIT_EDITMSG
	-rw-r-s---   1 root etckeeper     23 Jun  5  2013 HEAD
	drwxr-s---   2 root etckeeper   4096 Jun  5  2013 branches
	-rw-r-s---   1 root etckeeper     92 Jun  5  2013 config
	-rw-r-s---   1 root etckeeper     37 Jun  5  2013 description
	-rw-r-s---   1 root etckeeper  70979 Jun 28  2021 gitk.cache
	drwxr-s---   2 root etckeeper   4096 Jun  5  2013 hooks
	-rw-r-----   1 root etckeeper 397408 May 21 10:14 index
	drwxr-s---   2 root etckeeper   4096 Jul 11  2023 info
	drwxr-s---   3 root etckeeper   4096 Jul 11  2023 logs
	drwxr-s--- 260 root etckeeper   4096 May 17 14:04 objects
	-rw-r-s---   1 root etckeeper    105 Jul 11  2023 packed-refs
	drwxr-s---   4 root etckeeper   4096 Jun  5  2013 refs

Doesn't look dubious at all. Unless you are root you have to be in
the etckeeper group to get read access, restricted by the top level
directory and all underneath files and directories . Note the sticky
bit for the etckeeper group. What is wrong with that?

Every insightful comment is highly appreciated.


Regards
Harri

```

## Carlisle T. Hamlin, 2024-05-27 21:35

Subject: Re: git-shell vs "detected dubious ownership in repository"
Message-ID: <d3983115-bcf5-4ed2-b47a-56af297b6a9c@gmx.com>
URL: https://gitlist.dev/e/d3983115-bcf5-4ed2-b47a-56af297b6a9c%40gmx.com
In-Reply-To: <14ed85d8-dccb-4928-a4b8-a099d151fe5b@aixigo.com>

```
Hiya, Harald.

I'm not sure if this is intended behaviour, but I've always ever had 
that problem running my own servers when the group does not have write 
access to the directory containing the repository.

You might, as a troubleshooting step, try giving the group write access 
and see if that makes the problem go away.

Alternatively, you could also just add the directory as an exception 
using the command provided.

On 5/21/24 01:40, Harald Dunkel wrote:
> Hi folks,
> 
> since 2.45.1 (upgraded from 2.40.something) I cannot pull my
> etckeeper repositories anymore:
> 
>      # su - etckeeper
>      % cd /archive/host.example.com
>      % git remote -v
>      origin  host.example.com:/etc (fetch)
>      origin  host.example.com:/etc (push)
>      % git pull
>      fatal: detected dubious ownership in repository at '/etc/.git'
>      To add an exception for this directory, call:
> 
>              git config --global --add safe.directory /etc/.git
>      fatal: Could not read from remote repository.
> 
>      Please make sure you have the correct access rights
>      and the repository exists.
> 
> Please note there is git-shell on the remote side. Question is,
> what is dubious about the existing access bits of the remote repo?
> Currently I have
> 
>      root@host.example.com:/etc/.git# ls -al
>      total 532
>      drwxr-s---   8 root etckeeper   4096 May 21 10:14 .
>      drwxr-xr-x 242 root root       20480 May 18 06:28 ..
>      -rw-r-s---   1 root etckeeper   2716 May 17 14:04 COMMIT_EDITMSG
>      -rw-r-s---   1 root etckeeper     23 Jun  5  2013 HEAD
>      drwxr-s---   2 root etckeeper   4096 Jun  5  2013 branches
>      -rw-r-s---   1 root etckeeper     92 Jun  5  2013 config
>      -rw-r-s---   1 root etckeeper     37 Jun  5  2013 description
>      -rw-r-s---   1 root etckeeper  70979 Jun 28  2021 gitk.cache
>      drwxr-s---   2 root etckeeper   4096 Jun  5  2013 hooks
>      -rw-r-----   1 root etckeeper 397408 May 21 10:14 index
>      drwxr-s---   2 root etckeeper   4096 Jul 11  2023 info
>      drwxr-s---   3 root etckeeper   4096 Jul 11  2023 logs
>      drwxr-s--- 260 root etckeeper   4096 May 17 14:04 objects
>      -rw-r-s---   1 root etckeeper    105 Jul 11  2023 packed-refs
>      drwxr-s---   4 root etckeeper   4096 Jun  5  2013 refs
> 
> Doesn't look dubious at all. Unless you are root you have to be in
> the etckeeper group to get read access, restricted by the top level
> directory and all underneath files and directories . Note the sticky
> bit for the etckeeper group. What is wrong with that?
> 
> Every insightful comment is highly appreciated.
> 
> 
> Regards
> Harri
> 


```
