git push被拒绝,Pull Failed:致命:拒绝合并不相关的历史记录

时间:2017-04-07 13:55:15

标签: git github

我在Github控制台上创建了新的Repo 在Android Studio中,已提交并尝试推送到远程,推送被拒绝。

在工作室中,我能够与github成功连接。

尝试用Android工作室Git拉,得到:

Git Pull Failed: fatal: refusing to merge unrelated histories

即使在git bash中也有这个:

>git push origin master<br/>
To https://github.com/XXXX.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/XXX.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

1 个答案:

答案 0 :(得分:1)

In Android Studio,

转到master,mater - &gt; rebase到 - &gt; 你得到:

Rebase Successful: Rebased master on origin/master

然后用android studio推送。

enter image description here