git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-daemon not consulting ~/.gitconfig

From
MKmartin f krafft <madduck@madduck.net>
Date
Dec 4, 2024, 10:23 UTC
Message-ID
<fj5vgwmc5wtyzcxxnmcgw7whclm6qf7p5sxzh3nbao3feyutj6@daizbooxk22j>
Hello,

I found that git-daemon stopped serving repositories managed by gitolite, i.e. by a different Unix user. Hence, no big surprise that I would get

```
git-daemon[3126249]: detected dubious ownership in repository at '/srv/git/repositories/madduck/pub/etc/ssh.git'
                      To add an exception for this directory, call:
                      git config --global --add safe.directory /srv/git/repositories/madduck/pub/etc/ssh.git
```

in the logs. However, adding the config to `~gitdaemon/.gitconfig` did not have the desired effect. Neither did adding it to `~root/.gitconfig` and only `/etc/gitconfig` works.

So I checked `strace` and found that when invoked by `git-daemon`, Git doesn't even consult `~/.gitconfig`, and I think this may be a bug.

Here is the relevant strace for an access to git-daemon that triggers the above error:

``` root@alan:~# strace -fp 3146653 -e file 2>&1 | grep config [pid 3154713] access("/etc/gitconfig", R_OK) = 0 [pid 3154713] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 3 [pid 3154713] access("/etc/gitconfig", R_OK) = 0 [pid 3154713] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 4 [pid 3154713] openat(AT_FDCWD, "./config", O_RDONLY) = 4 [pid 3154713] access("/etc/gitconfig", R_OK) = 0 [pid 3154713] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 4 [pid 3154713] access("config", R_OK) = 0 [pid 3154713] openat(AT_FDCWD, "config", O_RDONLY) = 4 [pid 3154714] access("/etc/gitconfig", R_OK) = 0 [pid 3154714] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 3 [pid 3154714] access("/etc/gitconfig", R_OK) = 0 [pid 3154714] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 3 [pid 3154714] openat(AT_FDCWD, "./config", O_RDONLY) = 3 [pid 3154714] access("/etc/gitconfig", R_OK) = 0 [pid 3154714] openat(AT_FDCWD, "/etc/gitconfig", O_RDONLY) = 3 [pid 3154714] access("config", R_OK) = 0 [pid 3154714] openat(AT_FDCWD, "config", O_RDONLY) = 3 ```

[System Info] git version: git version 2.39.5 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.36 $SHELL (typically, interactive shell): /bin/bash

-- 
martin krafft | https://matrix.to/#/#madduck:madduck.net
 
officer, arrest that man! he's whistling a copyrighted song.
{: .blockquote }
 
spamtraps: madduck.bogus@madduck.net
{: .hidden }
Next: Konstantin Khomoutov
Message 1 of 2 in “git-daemon not consulting ~/.gitconfig”
  1. martin f krafftDec 4, 2024
  2. Konstantin KhomoutovDec 4, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.