1. 程式人生 > >【git】updates were rejected because the tip of your current branch is behind its remote counterpart

【git】updates were rejected because the tip of your current branch is behind its remote counterpart

剛建立的github版本庫,在push程式碼時出錯:

$ git push -u origin master
To [email protected]:******/Demo.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:******/Demo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

網上搜索了下,是因為遠端repository和我本地的repository衝突導致的,而我在建立版本庫後,在github的版本庫頁面點選了建立README.md檔案的按鈕建立了說明文件,但是卻沒有pull到本地。這樣就產生了版本衝突的問題。

有如下幾種解決方法:

1.使用強制push的方法:

$ git push -u origin master -f 

這樣會使遠端修改丟失,一般是不可取的,尤其是多人協作開發的時候。

2.push前先將遠端repository修改pull下來

git pull origin master

$ git push -u origin master

3.若不想merge遠端和本地修改,可以先建立新的分支:

git branch [name]

然後push

git push -u origin [name]

參考:

相關推薦

gitupdates were rejected because the tip of your current branch is behind its remote counterpart

剛建立的github版本庫,在push程式碼時出錯: $ git push -u origin master To [email protected]:******/Demo.git ! [rejected] master -> master (non-fast-forwa

Git提交失敗之 Updates were rejected because the tip of your current branch is behind

錯誤顯示 D:\devworkspace\ecpphoton\jcodef>git push To https://github.com/osxm/jcodef.git ! [rejected] master -> master (non-fast-forward)

git push 報錯"Updates were rejected because the tip of your current branch is behind"

在Android原始碼的修改過程中,在把本地的分支push到伺服器的時候遇到如下錯誤: error: failed to push some refs to '[email protect

Git報錯:Updates were rejected because the tip of your current branch is behind

使用git的過程中有時候會出現無法push的問題,報錯如下圖: 這是由於遠端repository和我本地的repository衝突造成,通常發生在多人協作的開發過程中 解決方法: 1.使用強制push的方法: git push -u origin

刪除github專案失敗時出現:Updates were rejected because the tip of your current branch is behind

刪除github上的專案失敗報錯如下 這是由於我本地的倉庫和遠端github倉庫發生了衝突導致的,解決方法如下 1.強制使用push git push -u origin master -f 注意:使用此方法會使遠端的修改丟失,一般是不可取的 2.推送前先將遠端倉

Updates were rejected because the tip of your current branch is behind 問題出現解決方案

提供如下幾種方式: 1.使用強制push的方法(多人協作時不可取): git push -u origin master -f 2.push前先將遠端repository修改pull下來 git pull origin master git push -u origin master 3.不想me

hint: Updates were rejected because the tip of your current branch is behind (報錯資訊 )

在github庫中手動添加了readme檔案,本地執行命令: git add . git commit -m "login and tasklist" git push origin master // 出

Git工作筆記004---torisegit使用時Updates were rejected because the tip of your current branch i

   JAVA技術交流QQ群:170933152        因為要跟別的公司一塊合作開發,我們用svn他們用git,現在又得用git  我在提交的時候:報如下錯誤: git.exe pu

Git提交到GitHub報錯:Updates were rejected because the remote contains work that you do not have locally

轉自:https://blog.csdn.net/u011284073/article/details/81609707  在使用Git將本地專案上傳到GitHub上時,鍵入命令: git push -u origin master 報錯提示:Updates were reject

git Updates were rejected because the remote contains work that you do 解決辦法

Username for 'https://github.com': dummymare Password for 'https://[email protected]': To https://github.com/dummymare/Hello-World

Updates were rejected because the remote contains work that you do

cau 需要 倉庫 cnblogs 提交 添加文件 cte ges soft 每次建立新的倉庫,提交的時總會出現這樣的錯誤,真是頭疼,...... 直接開始正題,git 提交的步驟: 1. git init //初始化倉庫 2. git add .(文件na

Updates were rejected because the remote contains work that you do hint: not have locally. This is u

今天在學習git時, $ sudo git push origin master 報錯了: To https://github.com/xxxxx/xxxx.git ! [rejected] master -> master (fetch firs

GitIt is also possible that a host key has just been changed. The fingerprint for the ECDSA key解決

今天提交程式碼,pull的時候.出現IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack

Debug-giterror:. local changes to the following files would be overwritten by merge:.idea/misc.xml

公司、個人編譯環境可能是有某些不為人知的差異,每次用git命令pull的時候,總會遇到一些奇葩問題,比如: ...done. Resolving deltas: 100% (55/55), completed with 29 local objects. From http

Git常見錯誤提示解決辦法和常用方法

log image 解決 遠程 添加 logs 遠程倉庫 錯誤 ima 1.添加遠程倉庫時提示fatal: remote origin already exists. 先刪除遠程倉庫,再添加遠程倉庫 最後再push 2.修改本地文件(比如README.md)後,更新到g

Git二、安裝配置

config 查看 projects set col utl font ssl user 一、Git安裝   Linux 1 $ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext 2 libz-dev

gitPorcelain and Plumbing

bin level eve 好用 bsp 要去 概念 proc 的人 git裏面有這兩個對立的概念 考慮一個管道系統 Porcelain意思是陶瓷的,好比說洗臉池,坐便器這樣。用戶能直接用的,非常好用的東西,叫Porcelain。 相比之下底層的東西就是水管,最

gitGit 提示fatal: remote origin already exists 錯誤解決辦法

遠程 分享 mage mod dal -s lock 解決 ack 今天使用git 添加遠程github倉庫的時候提示錯誤:fatal: remote origin already exists. 最後找到解決辦法如下: 1、先刪除遠程 Git

GITGit Flow最佳實踐

【GIT】Git Flow最佳實踐

gitgit分支的合並

stat diff 出錯 傳輸 .html read 簡單 流程 保存 原文: http://gitbook.liuhui998.com/3_3.html http://gitbook.liuhui998.com/5_3.html 一、如何分支的合並 在gi