Title says it all. I am using pygit2
and trying to figure out how to achieve following that I can do using git cli: git remote set-branches origin remote_branch_name
If might be simpler to set the configuration directly (since pygit2 Remotes has no obvious way to set the fetch URL)
Using 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'
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.