Bug 2281530 - git daemon complains about dubious ownership of repository
Summary: git daemon complains about dubious ownership of repository
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: git
Version: 40
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Ondřej Pohořelský
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-05-19 17:50 UTC by Maddy
Modified: 2025-05-20 08:49 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-05-20 08:49:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Maddy 2024-05-19 17:50:45 UTC
After upgrade to 2.45.1, git daemon has stopped working as expected.

Upon clone, git-daemon logs the following:

    [1482] Connection from ::1:45090
    [1482] Extended attribute "host": localhost
    [1482] Extended attribute "protocol": version=2
    [1482] Request upload-pack for '/test.git'
    fatal: detected dubious ownership in repository at '/var/lib/git/test.git'
    To add an exception for this directory, call:
            git config --global --add safe.directory /var/lib/git/test.git


Reproducible: Always

Steps to Reproduce:
1. Create repository under /var/lib/git/test.git
2. Ensure git.socket systemd unit is started
3. Run git clone git://localhost/test.git

Actual Results:  
git server refuses to read /var/lib/git/test.git because it detects dubious ownership
git client reports fatal: Could not read from remote repository.

Expected Results:  
git clone happens as usual

I run my own git daemon systemd unit which doesn't use socket activation, which runs as a git user. This makes it work repositories owned by the git user, but not for repos owned by local users.

My testing for this bug report is done with the git.socket unit on a fresh VM however.

This also reproduces over HTTP via Apache with the following VirtualHost config:

    SetEnv GIT_PROJECT_ROOT /var/lib/git
    SetEnv GIT_HTTP_EXPORT_ALL
    ScriptAlias / /usr/libexec/git-core/git-http-backend/
    <Directory "/usr/libexec/git-core">
        <Files "git-http-backend">
            Options +ExecCGI
            Require all granted
        </Files>
    </Directory>

Comment 1 Ondřej Pohořelský 2024-05-20 08:34:09 UTC
Thanks for the report. This failure is caused by security fixes in 2.45.1 and friends releases, which set strict policies for cloning local repositories not owned by git user.
I've sent a mail to upstream with part of your bug report [0]

[0]https://lore.kernel.org/git/CA+B51BGonS2DDTBQ2RsipW4Cyg5pRv0U71RAN9M1pcPjACtJ4A@mail.gmail.com/T/#u

Comment 2 Aoife Moloney 2025-04-25 10:46:13 UTC
This message is a reminder that Fedora Linux 40 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 40 on 2025-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '40'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 40 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Aoife Moloney 2025-05-20 08:49:12 UTC
Fedora Linux 40 entered end-of-life (EOL) status on 2025-05-13.

Fedora Linux 40 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.