Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

pygit2 does not respect a global setting of safe.directory='*'

Offen
#1,156 7 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
git, python
Bereich
security, tooling

Rechercherichtung

Beginne mit der reinen pygit2-Reproduktion unter Verwendung von pygit2.Repository und vergleiche sie mit der angezeigten globalen Config-Ausgabe für safe.directory=*. Untersuche die Prüfung des Repository-Eigentümers in pygit2 1.10.0 und überprüfe das Verhalten gegen Git 2.36.1. Als erledigt gilt die Aufgabe, wenn eine globale Wildcard-Einstellung für safe.directory das Öffnen des reproduzierten Repositorys ohne den Eigentumsfehler ermöglicht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

We are currently working with dvc for multiple projects and the dvc exp run leads to a pygit2 exception on a azure machine learning instance. This leads to problems since folders on mounted drives in azure belong to user root whilst the working user is azureuser The exception looks like following:

_pygit2.GitError: /mnt/batch/tasks/shared/LS_root/mounts/clusters/<XXX>/.git/: repository path '/mnt/batch/tasks/shared/LS_root/mounts/clusters/<XXX>' is not owned by current user

A workaround for this problem should be setting the git safe.directory to ='*'.
But unfortunately this does not work with dvc resp. pygit2.

I narrowed the problem down and was able to reproduce it with pure pygit2.
Since it seems to be a pygit2 problem, I am opening the issue directly here.
FYI @efiop, @skshetry, @dmpetrov

My git config looks as follows:

user.email=<XXX>
user.name=<XXX>
safe.directory=*

With my normal git (git version 2.36.1) everything works great with the wildcard *. But pygit2 seems to ignore this config.

import pygit2
repo = pygit2.Repository(pygit2.discover_repository('.'))
GitError: /mnt/batch/tasks/shared/LS_root/mounts/clusters/<XXX>/.git: repository path '/mnt/batch/tasks/shared/LS_root/mounts/clusters/<XXX>/' is not owned by current user

But the config seems to be loaded:

import pygit2
config = pygit2.Config()
for x in config.get_global_config():
    print(x.name + ":" + x.value)
user.email:<XXX>
user.name:<XXX>
safe.directory:*

Used Versions: pygit2 1.10.0

Any help would be really appreciated, since we can't run experiments anymore.

Vorherrschende Sprache
Python
Sterne
1.7k
Forks
408
Ø Merge
2 T. 57 Min.
Gemergte PRs (30 T.)
7

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus libgit2/pygit2

Alle Issues in libgit2/pygit2

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.