F:\abb-iot\DmsAPI\DmsAPI (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 '[email protected]: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