zoukankan      html  css  js  c++  java
  • 解决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'

  • 相关阅读:
    自定义可下拉刷新列表
    在listview里面的checkbox被选中或取消
    [转]Android中音乐文件的信息详解【安卓源码解析二】
    service 和broadcastreceiver的简略小结
    闹铃
    hdu 2112赤裸裸的最短路
    hdu 2177错题,很水的测试数据
    hdu 2184模拟
    hdu1150最小点集覆盖
    hdu 3746KMP的应用
  • 原文地址:https://www.cnblogs.com/webqiand/p/15511965.html
Copyright © 2011-2022 走看看