公众号:架构师与哈苏
关注公众号进入it交流群! 公众号:架构师与哈苏 不定时都会推送一些实用的干货。。。
  • 初始化
git init
  • 添加文件到本地仓库
git add .
  • 提交文件到本地仓库
git remote add origin 仓库地址
  • 拉去远程仓库代码
git pull origin master
  • 推送代码到远程仓库
git push origin master
  • 然后会出现错误
To https://gitee.com/wuzhiqi123/demo-spring-batch.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/wuzhiqi123/demo-spring-batch.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 origin master --allow-unrelated-histories
  • 重复上面操作
git add .
git commit -m 'init'
git push origin master
posted on 2021-02-23 17:15  公众号/架构师与哈苏  阅读(331)  评论(0编辑  收藏  举报