[英]Python GIT CHeckout failed due to: exit code(1)
i have an git repo in gitlab.我在 gitlab 中有一个 git 回购。 I tried to checkout the master branch with the following lines.
我尝试使用以下几行检查主分支。
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')
But i got the following error.但我收到以下错误。
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.'
What i know repo.git.checkout("HEAD~1") works fine.我所知道的 repo.git.checkout("HEAD~1") 工作正常。 Where is my issue?
我的问题在哪里?
The default branch in gitlab since v14.0 is main
and not master
.自 v14.0 以来,gitlab 中的默认分支是
main
而不是master
。 Read here for more info: https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/阅读此处了解更多信息: https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.