标题说明了一切。我正在使用pygit2
并试图弄清楚如何使用git cli可以实现以下目标:
git remote set-branches origin remote_branch_name
答案 0 :(得分:1)
如果直接使用set the configuration可能更简单(因为pygit2 Remotes没有设置获取网址的明显方法)
使用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'
)