错误:
Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.
有如下几种解决方法:
1.使用强制push的方法:
$ git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2.push前先将远程repository修改pull下来
$ git pull origin master
$ git push -u origin master
3.若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$ git push -u origin [name]
本文介绍了解决Git中遇到的更新被拒绝错误,因为当前分支的顶端落后于其远程对应分支。提供了三种解决方案:强制推送(可能导致远程修改丢失)、先拉取远程修改再推送,以及创建新分支进行推送。
674

被折叠的 条评论
为什么被折叠?



