Updates were rejected because the tip of your current branch is behind

499 阅读1分钟

git第一次提交时,可能会遇到这个问题

场景

$ git push origin master

git会报错

Updates were rejected because the tip of your current branch is behind

解决方案

在push先执行以下指令

git pull origin master --allow-unrelated-histories