小编Rah*_*mad的帖子

GitPython:git push - 设置上游

我使用 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)

python gitpython gitlab

7
推荐指数
1
解决办法
3982
查看次数

标签 统计

gitlab ×1

gitpython ×1

python ×1