繁体   English   中英

Python GIT 结帐失败,原因是:退出代码(1)

[英]Python GIT CHeckout failed due to: exit code(1)

我在 gitlab 中有一个 git 回购。 我尝试使用以下几行检查主分支。

repo = git.Repo(os.path.dirname(__file__), search_parent_directories=True)
repo.git.checkout("master")
ref_repo_root = os.path.join(WORKING_DIRECTORY, 'ref_decoders')

但我收到以下错误。

E   git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
E     cmdline: git checkout master
E     stderr: 'error: pathspec 'master' did not match any file(s) known to git.'

我所知道的 repo.git.checkout("HEAD~1") 工作正常。 我的问题在哪里?

自 v14.0 以来,gitlab 中的默认分支是main而不是master 阅读此处了解更多信息: https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM