
git 初始化
git init
git remote add origin xxx.git
git add -A
# 拉取远程代码
git pull origin master
## 推送
git push origin master
问题
拉取错误
fangmindeMBP:security-demos lichao$ git pull origin master
From https://gitee.com/lee26/Spring-boot-demos
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
解决办法
git pull origin master --allow-unrelated-histories
推送错误
fangmindeMBP:security-demos lichao$ git push -u origin master
To https://gitee.com/lee26/Spring-boot-demos.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/lee26/Spring-boot-demos.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最新代码,再push




近期评论