簡體   English   中英

為什么在git中出現非快速轉發錯誤?

[英]Why do I get non-fast-forward error in git?

我沒有分支,並且是當前唯一推送到該信息流的人,為什么我這樣做

git push

我得到:

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dsak.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

執行git pullgit push正常運行。

執行git pullgit push正常運行。

顯然,遠程回購中有一些提交在本地回購中不存在。 如果您在某個時候使用了git reset ,進行了修改或以其他方式更改了現有的提交,則可能會發生這種情況(盡管git pull應該會給您一個警告,如果是這種情況),或者您是從另一個倉庫(例如一個倉庫)推送到遠程的在另一台計算機上)。

不,沒有在本地不存在的遠程上提交,但反之亦然,我添加的文件不在本地的遠程上

您可能具有相同的提交,但是SHA1必須有所不同。
如果您在任何時候都對母版進行了rebase(包括rebase --interactive,只是為了重新排序或刪除master本身中的某些提交),就會發生這種情況。

當具有相同的提交(甚至相同的SHA1)時會彈出該錯誤消息的唯一其他情況是,當您具有沖突的標記時 (但我認為這並不適用)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM