vue初始化项目后,git提交到gitee远程仓库
使用vue create 初始化cli3项目后,在git新建仓库,使用git工具提交到gitee远程仓库
直接使用“git remote add origin https://gitee.com/huanmeng122/preparation.git
”提交后,会提示错误:
fatal: remote origin already exists.
翻译如下:
fatal: remote origin already exists.
致命:远程源已存在。
需要运行如下命令:git remote rm origin
在使用如下命令:git remote add origin https://gitee.com/huanmeng122/preparation.git
然后按照正常操作运行 git push origin master
继续报错如下:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/huanmeng122/preparation.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.
需要运行命令 git pull https://gitee.com/huanmeng122/preparation.git master
提醒如下:
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
翻译如下:
致命:拒绝合并不相关的历史记录
使用强制合并命令:git pull origin master --allow-unrelated-histories
成功,然后处理冲突。
提交远程仓库git push --set-upstream origin master