git 本地项目上传github失败

报错: 

至此,项目就上传到github上了,完成一件事情,总是很开心的,加油!

To https://github.com/GaoJingsi/shiro-permission-management-system.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/GaoJingsi/shiro-permissio
n-management-system.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.

原因:

远程仓库有readme.md,而本地没有。

解决方案1:

git pull --rebase origin master
git push -u origin master

git pull --rebase origin master意为创建readme.md。

解决方案2:

git push -u origin master -f

git push -u origin master -f意为强制推送。

你可能感兴趣的:(git,git)