pygit2 does not respect a global setting of safe.directory='*'
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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