使用git在本地进行修改之后提交的时候碰到如下错误:
$ git push origin leen:leen
To ssh://git@IP:端口/Out/Afuyigou.git
! [rejected] leen -> leen (non-fast-forward)
error: failed to push some refs to 'ssh://git@IP:端口/Out/Afuyigou.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.
从网上查询得知是当前分支和远程分支不一致所致,解决方法如下:
1.git fetch #获取远程分支最新内容
2.git merge origin/远程分支 #将远程分支上的内容合并到当前分支
再次push就OK了。如图:
Author:leedaning
本文地址:http://blog.csdn.net/leedaning/article/details/50668458