将git项目提交到其他的git仓库
1. 一般想法
git push https://gitee.com/xxx.git
2. 提示--set-upstream
git push --set-upstream https://gitee.com/xxx.git master
3. 报错
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/xxx.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.
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
4. 解决办法
原来的思路,只不过在pull的时候添加–allow-unrelated-histories
git pull https://gitee.com/xxx.git master --allow-unrelated-histories
5. 提交
git push https://gitee.com/xxx.git master
6. 补充(git pull 和git fetch的区别):
git pull = git fetch + git merge
|