Rah*_*mad 7 python gitpython gitlab
我使用 GitPython 克隆主分支并签出功能分支,我进行本地更新、提交并推送回 git。代码片段如下所示,
注意:我的分支名称是 feature/pythontest
def git_clone():
repo = Repo.clone_from(<git-repo>, <local-repo>)
repo.git.checkout("-b", "feature/pythontest")
# I have done with file updates
repo.git.add(update=True)
repo.index.commit("commit")
origin = repo.remote(name="origin")
origin.push()
Run Code Online (Sandbox Code Playgroud)
当我执行脚本时,出现以下错误,
To push the current branch and set the remote as upstream, use
git push --set-upstream origin feature/pythontest
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3982 次 |
| 最近记录: |