在写项目的时候,我通常在windows本地写好之后更新到github上,如果项目有更新,我一般就在本地更新,然后在用git去更新github上的项目,这里就会有一个问题,就会报一大堆错误,大意就是远程master已经存在了,你再重新搞一个master去更新就不行。拒绝!!!
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'ssh://git@xxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
根据提示,你得把原来的项目拉下来,把master也拉下来,这样就是一个master了
git pull 项目地址
再提交即可 git push -u oringin master