• 解决error: failed to push some refs to 'xxxx'


    今天将项目修改了一部分,然后用 git push origin master 向远程仓库推送的时候报如下错误:

    error: failed to push some refs to 'https://github.com/ZJyoung1997/JZShop.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    原因是远程仓库中的文件和我们本地的仓库有差异,例如你的远程仓库有个文件Readme. md,但是本地仓库却没有,就可能会出现这种情况。 我的就是远程仓库中有Readme. md文件,而本地仓库中没有该文件造成的。还有就是因为平时在协会中,用协会电脑开发,回到寝室后又会用自己的电脑开发,这可能也是导致这种问题的原因。这种情况有解决办法,就是将本地仓库直接干掉,然后重新从远程clone一个,但是这样显然太麻烦了,可以用合并分支的方法

    解决办法:

    git pull --rebase origin master

    git pull命令用于从另一个存储库或本地分支获取并集成(整合),取回远程主机某个分支的更新,再与本地的指定分支合并。

    fatal: 'master' does not appear to be a git repository
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.

    用 git pull origin master --allow-unrelated-histories 解决

    原文地址:解决error: failed to push some refs to 'xxxx'

  • 相关阅读:
    【Go】http server 性能测试
    【go】基础
    【Git】gitcongfig 增删改查
    【go】sdk + idea-plugin 开发工具安装
    【Ibatis】总结各种使用技巧
    【nodejs】jade模板入门
    各语言技术列表
    【nodejs】 npm 注意事项
    PAT-l3-002堆栈
    统计相似字符串
  • 原文地址:https://www.cnblogs.com/webqiand/p/15511965.html
Copyright © 2020-2023  润新知