pygit2 does not respect a global setting of safe.directory='*'
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
pygit2.Repositoryを使用した純粋なpygit2の再現から始め、safe.directory=* に対して表示されるグローバルなConfigの出力と比較します。pygit2 1.10.0におけるリポジトリ所有権チェックを調査し、Git 2.36.1に対して動作を検証します。グローバルなワイルドカードのsafe.directory設定によって、再現したリポジトリを所有権エラーなしで開けることを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- git, python
- 領域
- security, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100