git fatal: ‘xxx‘ is not a commit and a branch ‘xxx‘ ‘ cannot be created from it

这篇具有很好参考价值的文章主要介绍了git fatal: ‘xxx‘ is not a commit and a branch ‘xxx‘ ‘ cannot be created from it。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

错误背景

当拉取一个git远程仓库分支时报错:

命令:git checkout -b 本地分支名 远程分支名

报错:fatal: 'origin/dev_v2.8.4_v10.74.1' is not a commit and a branch 'dev_v2.8.4_v10.74.1' cannot be created from it

主要原因

远程新建的分支没有更新到本地。实际上,git仓库分为本地仓库和远程仓库,我们用checkout命令是从本地仓库中找要检出的分支的。本地仓库只有在进行网络请求时才会跟远程仓库交互,比如fetch命令。

处理方式

将远程仓库数据到本地,使用两个命令:

1:git fetch origin

2:git remote update origin --prune

执行完这两步后在重新拉下分支就ok啦。

小提示:

git remote update 用于更新远程仓库的信息。(它会下载最新的版本库数据,并更新本地仓库的所有指针(例如远程分支和远程标签)。这样,你就可以在本地仓库中看到最新的远程分支和标签了)

git fetch 命令与一个远程程序的仓库交互,并且将远程程序库中有但在当前仓库中没有的所有信息拉下来后仍然存储在你本地数据库中。文章来源地址https://www.toymoban.com/news/detail-690445.html

到了这里,关于git fatal: ‘xxx‘ is not a commit and a branch ‘xxx‘ ‘ cannot be created from it的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Descriptors cannot not be created directly

            在运行诸如深度学习python等程序时,如mmdetection、mmdetection3d中的程序,会出现报错:“Descriptors cannot not be created directly”。详细报错如下:         TypeError: Descriptors cannot not be created directly.         If this call came from a _pb2.py file, your generated code is out of date

    2024年02月16日
    浏览(23)
  • 解决:TypeError: Descriptors cannot not be created directly

    我使用pip命令下载安装paddlepaddle库,具体命令如下所示,采用清华镜像源,这样下载速度更快! 安装完成后,我来在python文件中导入飞浆,输出其版本号,具体如下所示: 但是,PyCharm却报错,具体报错信息如下所示: 其实,仔细阅读报错信息就会发现,报错的主要原因是因

    2024年02月11日
    浏览(35)
  • 已解决TypeError: Descriptors cannot not be created directly.

    已解决TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc = 3.1.0If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUPFERS_PYTHON_iMPLEME

    2023年04月08日
    浏览(35)
  • Commit cannot be completed since the group has already rebalanced and assign

    这里是说提交commit失败, 因为这个组已经重新分配了 正常情况下, kafka会有一个配置用于设置一条消息的过期时间, 在规定时间内, 如果消费者提交了消费完成的信息, 那么就可以正常的分配下一条记录给消费者, 并且将当前记录的状态记为\\\"已消费\\\"状态, 对消息队列做一个标识

    2024年02月11日
    浏览(35)
  • fatal: could not create work tree dir ‘xxx’: Permission denied解决办法

    场景:当去clone仓库的时候发生错误 报错内容:fatal: could not create work tree dir ‘hui-mobile2.0’: Permission denied 自查方法:去磁盘根目录下,右键–新建,如果只有文件夹一个选项,并且文件夹前面还有管理员权限的图标,就证明你也是把权限给关了 解决办法:在磁盘任意位置,

    2024年02月11日
    浏览(36)
  • [Bug0034] Git报错 cannot lock ref 'refs/heads/master': is at xxxx but expected xxx error: could not ...

    1、问题 error: update_ref failed for ref \\\'refs/heads/master\\\': cannot lock ref \\\'refs/heads/master\\\': is at 63654e79f7ae0f902731558b3ae6679a69db09e9 but expected ec20d6ffa52920358e54703f90100bedbca4c855 error: could not update refs/heads/master 2、场景 由于为了方便解决冲突获取到最新远程代码(并且本地有冲突代码不想要),直接删

    2024年02月16日
    浏览(37)
  • 已解决TypeError: Descriptors cannot not be created directly异常的正确解决方法,亲测有效!!!

    已解决TypeError: Descriptors cannot not be created directly异常的正确解决方法,亲测有效!!! 文章目录 问题分析 报错原因 解决思路 解决方法 总结 在Python开发中,当你尝试以不恰当的方式使用描述符(descriptor)时,可能会遇到一个错误提示:“TypeError: Descriptors cannot not be created dir

    2024年02月21日
    浏览(32)
  • git问题解决:git add . 时,fatal: Unable to create ‘xxx/.git/index.lock‘: File exists.

    造成的原因是在某些比较费时的git操作时自动生成 index.lock文件,操作结束后自动删除,相当于一个锁定文件,目的在于防止对一个目录同时进行多个操作。  有时强制关闭进行中的git操作,这个文件没有被自动删除,之后你就无法进行其他操作,必须手动删除,进入.git文件

    2024年02月08日
    浏览(44)
  • GIT 错误 On branch master Your branch is up to date with ‘origin/master‘. nothing to commit, working

    我的理解:分支被意外删除 #先查看分支—应该会有一个 *master—不管他 #切到 master 分支,提示 #直接切换到 ‘origin/master’ 分支 #更新,推送一套走完 #检测分支‘git branch‘,有如下提示就,按部就班 #继续执行 重新提交 切换到 master 分支 可以删除 origin/master 分支

    2024年02月11日
    浏览(36)
  • Your branch is ahead of ‘origin/master‘ by 2 commits. (use “git push“ to publish your local commit

    遇到问题: Your branch is ahead of \\\'origin/master\\\' by 2 commits.   (use \\\"git push\\\" to publish your local commits) 首先一定要自己手动备份一份代码 防止意外 这个消息表示你的本地分支比远程仓库的 master 分支超前了2个提交。这通常发生在你在本地进行了一些提交,但还没有将这些提交推送到远

    2024年02月04日
    浏览(44)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包