Git问题--Push rejected: Push to origin/master was rejected

我与影子孤独终老i 提交于 2020-01-21 16:39:34

解决git问题

Push rejected: Push to origin/master was rejected

意思是git拒绝合并两个不相干的东西 
此时你需要在打开Git Bash,然后进入相应的目录,然后敲git命令

$ git pull origin master --allow-unrelated-histories

出现类似于这种信息就说明pull成功了:

$ git pull origin master --allow-unrelated-histories
From https://github.com/yanghaopeng/python_utils
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 utils/hello.py | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 323 insertions(+), 31 deletions(-)

将本地仓库中的推送到github中,使用如下的git命令:

$ git push -u origin master

完了,去刷新github,就可以看到东西已经推送成功 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!