【发布时间】:2020-10-08 00:07:55
【问题描述】:
标题说明了一切。我正在使用pygit2 并试图弄清楚如何使用 git cli 来实现以下目标:
git remote set-branches origin remote_branch_name
【问题讨论】:
标题说明了一切。我正在使用pygit2 并试图弄清楚如何使用 git cli 来实现以下目标:
git remote set-branches origin remote_branch_name
【问题讨论】:
如果直接set the configuration 可能更简单(因为pygit2 Remotes 没有明显的方法来设置获取 URL)
使用Config.set_multivar(name, regex, value):
repo_obj = pygit2.Repository(repopath)
repo_obj.config.set_multivar(
'remote.origin.fetch',
'',
'+refs/heads/remote_branch_name:refs/remotes/myOrigin/remote_branch_name'
)
【讨论】: