关联吸纳的remote首次push报错rejected

Posted gloryhope

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关联吸纳的remote首次push报错rejected相关的知识,希望对你有一定的参考价值。

F:abb-iotDmsAPIDmsAPI (master -> origin)
λ  git push --set-upstream github master
To github.com:G****c/DmsAPI.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ‘git@github.com:Glorycsc/DmsAPI.git‘
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull ...‘) before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.

  

 

入如果pull有这个报错:
fatal: refusing to merge unrelated histories

  此项错误是由于本地仓库和远程有不同的开始点,也就是两个仓库没有共同的 commit 出现的无法提交。这里我们需要用到 --allow-unrelated-histories。也就是我们的 pull 命令改为下面这样的:

git pull origin master --allow-unrelated-histories

如果设置了默认分支,可以这样写:

git pull --allow-unrelated-histories

以上是关于关联吸纳的remote首次push报错rejected的主要内容,如果未能解决你的问题,请参考以下文章

Push rejected: Push master to origin/master was rejected by remote(IDEAMACGIT)

Git push remote rejected {change ### closed}

git push报错:remote: error: refusing to update checked out branch: refs/heads/master

! [remote rejected] master -; master (hook declined) error: failed to push some refs to 'https:/

错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )(代码

错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )(代码