[英]pygit2: How to “git remote set-branches origin remote_branch_name”
標題說明了一切。 我正在使用pygit2
並試圖弄清楚如何使用 git cli: git remote set-branches origin remote_branch_name
來實現以下目標
如果直接設置配置可能更簡單(因為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'
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.