git提交时报错:Updates were rejected because the tip of your current branch is behind......解决方案

 

报错:

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)