本次新建仓库与远程仓库进行关联是时,有时会存在错误。可以参考如下操作:
git init
git remote add origin XXX
git add .
git commit -m "初始化"
git push -u origin master
提示需要先拉去,报错如下: To https://gitee.com/tylerGuo1/dailyRecord.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/tylerGuo1/dailyRecord.gi 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.
git pull origin master
报错如下:
- branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories
git pull origin master --allow-unrelated-histories
git push -u origin master