简体   繁体   English

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

[英]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.

相关问题 Gradle 任务 assembleDebug 失败,退出代码为 1 flutter - Gradle task assembleDebug failed with exit code 1 flutter 完成错误:Gradle 任务 assembleDebug 失败,退出代码为 1 - Finished with error: Gradle task assembleDebug failed with exit code 1 异常:Gradle 任务 assembleDebug 失败,退出代码 1 和 dart:html 错误 - Exception: Gradle task assembleDebug failed with exit code 1 and dart:html Error GITLAB CI 加载密钥“/dev/fd/63”时出错:格式无效错误:作业失败:退出代码 1 - GITLAB CI Error loading key "/dev/fd/63": invalid format ERROR: Job failed: exit code 1 无法使用 Git 结帐其他分支机构 - Can't checkout other branch's with Git golang 1.17 构建失败 [gcc 失败:退出状态 1] - golang 1.17 build failure [gcc failed: exit status 1] unity build iOS framework add failed due to a CocoaPods 安装失败 - Unity build iOS framework addition failed due to a CocoaPods installation failure 由于配置错误导致执行失败:Lambda 函数的权限无效 - Execution failed due to configuration error: Invalid permissions on Lambda function GitLab CI。 作业失败并出现错误:错误:作业失败:退出状态 9009 - GitLab CI. Job failed with error: ERROR: Job failed: exit status 9009 pip3 install firebase-admin 在命令“python setup.py egg_info”失败,错误代码为 1 - pip3 install firebase-admin fails at Command "python setup.py egg_info" failed with error code 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM