提示 error: failed to push some refs to ‘https://github.com/xxx"/>
git项目初次push提示 error: failed to push some refs to ‘https://github.com/xxx
问题描述:当你的项目不是先从远程仓库pull下来,再push的话,可能会出现 push被拒绝问题,
! [rejected] cfj -> cfj (non-fast-forward)
error: failed to push some refs to '
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
可以通过以下方法解决:有帮助的话,关注点个赞~~~~~
通过命令行方式解决问题后,再用Idea 操作push,pull 一切正常。
1.首先找到项目的本地仓库位置
2. 右键打开 git base here
3. 首先确定远程仓库连接正确无异常
使用git命令,查看项目是否与远程仓库连接正常 ,下图显示连接正常!
git remote -v
如果连接不正确,请先配置正确远程仓库;如果连接正常的话,可通过以下两种方式进行解决:
* * 第一种方式:通过强制推送的方式进行上传
git push -f origin master
本地代码成功上传!!! 接着再用Idea 操作push,pull 一切正常。
** 第二种方式:先执行从远程仓库拉取操作,后执行push上传
git pull origin master --allow-unrelated-histories
git push origin master
图中由于我用方法一已经成功上传,所以这里仓库没有更改操作。接着再用Idea 操作push,pull 一切正常。
完结撒花,有帮助希望点个赞~~~~~
更多推荐
git项目初次push提示 error: failed to push some refs to ‘https://github.com/xxx
发布评论