pygit2 does not respect a global setting of safe.directory='*'
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 408
- Ø Merge
- 2 T. 57 Min.
- Gemergte PRs (30 T.)
- 7
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
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.
Bewertung
- Tech-Stack
- git, python
- Bereich
- security, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100