git推操作错误
我对git有点新。当我尝试推送文件到远程回购我收到以下错误,我经历了大量的谷歌搜索,但没有得到正确的答案。任何人请帮助。我也跟着git推操作错误
Note: i have some updated files in remote repo added by others
的步骤,推动
我在我的本地回购
我加入,并承诺该文件中的“sample.txt的”,现在我的工作目录是干净的。
-
现在我想
$ git push sample master
错误:
To github.com:xxxxxx/sample.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:xxxxx/sample.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.`
Note: i have some updated files in remote repo added by others
For reference please check this image
什么能为t
branch master -> FETCH_HEAD * [new branch] master -> sample/master fatal: refusing to merge unrelated histories
所以,你需要使用git标志allow-unrelated-histories
拉:他可能的解决方案?,好心用一个例子
解释您按照这里的评论部分中提到的git pull
错误。然后做推。
$ git pull sample master --allow-unrelated-histories
$ git push sample master
--allow-unrelated-histories:
By default, git merge command refuses to merge histories that do not share a common ancestor. This option can be used to override this safety when merging histories of two projects that started their lives independently. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.
我试图拉:> FETCH_HEAD 致命 - –
尝试'git pull sample master --allow-unrelated-历史' –
谢谢,这工作正常 –
你尝试读取错误消息的信息? – jonrsharpe
是的,我读了,我试图抓取,拉动机器人什么都没有工作 –
然后显示你已经尝试了什么,发生了什么,**作为文本**。拒绝合并无关的历史 ' – jonrsharpe