git问题--Push rejected: Push to origin/master was rejected
Posted 一只小小寄居蟹
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git问题--Push rejected: Push to origin/master was rejected相关的知识,希望对你有一定的参考价值。
解决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,就可以看到东西已经推送成功
以上是关于git问题--Push rejected: Push to origin/master was rejected的主要内容,如果未能解决你的问题,请参考以下文章
GitIDEA+Git使用过程中git push rejected解决
Git上传项目提示Push rejected: Push to origin/master was rejected解决办法
Push rejected: Push master to origin/master was rejected /failed to push some refs to /git did not