1. 程式人生 > >git push被拒絕的處理方式

git push被拒絕的處理方式

    有時候我們使用git  push向遠端倉庫推送的時候,會報錯如下:

[remote rejected] master -> master (branch is currently checked out)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To 
[email protected]
:/var/git.server/.../web ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to '[email protected]:/var/git.server/.../web'
     這是因為git預設是拒絕push操作的,我們在.git/config裡面新增如下配置項即可:
 [receive]
    denyCurrentBranch = ignore
      這是當我們初始化一個遠端倉庫的時候,使用git  --bare  init即可了,而不是使用git  init,這樣那麼該遠端倉庫的目錄下,也包含work  tree,當本地倉庫向遠端倉庫push時,如果遠端倉庫正在push的分支上時,那麼push後的結果不會反映在work  tree上,也就是在遠端倉庫的目錄下對應的檔案還是之前的內容,必須使用git  reset  --hard才能看到push之後的內容。

      注意如果當時不在push的分支上,是沒問題的。

相關推薦

git push拒絕處理方式

    有時候我們使用git  push向遠端倉庫推送的時候,會報錯如下: [remote rejected] master -> master (branch is currently checked out) remote: error: refusing to

git push 失敗的處理方式

遠端建立了含有Readme的倉庫, 本地初始化並添加了遠端倉庫後, push卻失敗了, 出現提示: $ git push origin dev To https://git.oschina.net/erchoc/laradock.git ! [rejected]

git push忽略的檔案 處理

1.檢視有哪些分支  git branch 2.檢視有哪些檔案  ls 3.刪除遠端的檔案/資料夾,git rm -r --cached 檔案(如:git rm -r --cached node_modules) 4.提交刪除內容  git commit -a -m '刪除

git clone、push 提示輸入密碼但輸入後登入拒絕

1 password 情景描述: 正確生成,並配置好SSH key後,clone project 時,提示輸入密碼,輸入密碼後,一直顯示不對,三次嘗試後,clone失敗。 其他類似操作也會出現這樣的失敗,如:ssh -T [email prot

產品經理如何與強勢的技術溝通? 技術比較有資歷,會以技術無法實現等方面的原因拒絕處理產品提出的需求。 你們是否遇到這樣的技術? 產品懂技術的話,是不是會好一些,因為可以和技術說“行話”了,並且產品懂技術就不會忽悠了。

intern 世界 自己人 做好自己 最重要的 叠代開發 對比 不一定 制造 PM在YY...作為強勢的技術來回答一下吧。說明白WHY,HOW,WHAT就好了。 我想點兩個贊,u can u up,no can no bb 什麽的。 微軟的win8之父年輕時候也是一個PM應

[轉發]解決 git push Failed to connect to 127.0.0.1 port 45463: 拒絕連接

pre host 導致 占用 span www. git push github con 使用Github pull 代碼突然報錯: Failed to connect to 127.0.0.1 port 43421: Connection refused 使用 ls

據庫標記為RESTORING的處理方式

stats int http ces 繼續 無法打開 air over 語句 轉自:http://limindo.blog.163.com/blog/static/264758562010116115412141/ 嘗試數據庫被標記為RESTORING的處理方式   /**

刪除win7系統文件夾訪問拒絕怎麽處理

www 技術分享 方法 通過 刪除文件 對象權限 賬戶 tor 繼承 常常我們在使用windows7系統的過程中,需要執行刪除文件夾的操作,以此來擴大系統的硬盤空間,來加快系統的運行速度;用戶表示在執行這樣的操作時系統彈出窗口提示“文件夾訪問被拒絕”的情況,最終也導致文件夾

window.open方法瀏覽器攔截的處理方式

問題現象 當我們在一個 ajax 回撥中執行 window.open 方法時,新頁面會被瀏覽器攔截。 原因 在 Chrome 的安全機制裡,非使用者直接觸發的 window.open 方法,是會被攔截的。 處理 $('#jump-btn').on('click', funct

記一次生產環境物理機磁碟/目錄日誌打滿處理方式(logrotate失效)

#山東梅長蘇 監控發現物理機/目錄使用率一直100%,messages和secure日誌特別大,應用已無法啟動。logrotate不生效排查了好長時間,原來的處 理方式是logrotate /etc/logrotate.conf加-f強制執行,但這種方式並沒有

\\IP\e$方式訪問伺服器的E盤拒絕是什麼原因?

問題:伺服器本地管理員的許可權,首先訪問是被拒絕而不是報使用者名稱密碼錯誤;其次遠端桌面伺服器是可以訪問我個人點的D、E盤的開啟預設共享方法:先在控制面板的“服務”,看SERVER服務是否啟動,如果沒有啟動,則將設定為自動或者手動,然後再選擇啟動。開啟系統的預設共享的方法1.檢查AutoShareServer

git clone 分支的新建與合併及更新拒絕拒絕解決方法

1 . 建立分支 git checkout -b huanfengchen(分支的名字) 2 提交你修改的內容 git commit -a -m "對修改內容的描述" 3 切換到master分支 git checkout master 4 合併分支  git merge h

"SQL Server 不存在或訪問拒絕","無法連線到伺服器,使用者xxx登陸失敗","連線超時"處理方法

一."SQL Server 不存在或訪問被拒絕" 這個是最複雜的,錯誤發生的原因比較多,需要檢查的方面也比較多. 一般說來,有以下幾種可能性: 1,SQL Server名稱或IP地址拼寫有誤 2,伺服器端網路配置有誤 3,客戶端網路配置有誤 要解決這個問題,我們一般要遵循以

使用者授權時拒絕的解決辦法(授權失敗場景處理)

因為當下在做的小程式功能必須獲取使用者資訊才能操作,所以在index頁面就彈使用者授權了,此處參考了【這篇文章】。文章中提到一點開小程式就彈使用者授權多少會對使用者造成一定的心裡壓力,所以大家還是按照自己的需要來。如果有不一樣的思路歡迎交流 :) 1.

WCF釋出後IP解析伺服器名問題處理方式

WCF 釋出後IP地址被解析成伺服器名,造成如下錯誤: 沒有終結點在偵聽可以接受訊息的 http://iz94v4n3ck0z/IFarmDelivery/DeliveryService.svc。這通常是由於不正確的地址或者 SOAP 操作導致的。如果存在此情況,請參見 I

git GitHub 常見問題處理方法(git push / git log)

1、fatal: this operation must be run in a work tree 出現這種情況的原因是,你Git所在的目錄不是工作目錄,需要轉到工作目錄,才可進行git命令的操作 2、git log --pretty=oneline 檢視當前commit提交的任務列表,並

git clone 許可權拒絕

當你想要把自己的程式碼上傳到github上時,需先在自己的github上建立一個倉庫,然後使用Git GUI(必須是Git GUI 不能是Git bash,bash不支援上傳!)。把你要上傳到的倉庫的url拷貝到下面的Source Location的text框裡,再在Target Directory的text

程序執行緒中睡眠函式(sleep)訊號中斷後失效,處理方式總結

#include #include #include #include #include #include void tid1_handler(void *arg); void tid1_SIGINT_fun(int signo); void tid1_SIGQUIT_fun(int signo); vo

ubuntu git安裝與使用+更新被拒絕,因為遠端倉庫包含您本地尚不存在的提交。這通常是因為另外 提示:一個倉庫已向該引用進行了推送+更新被拒絕,因為您當前分支的最新提交落後於其對應的遠端分支

1 安裝安裝方式主要有兩種,即通過Apt和source:1.1 通過Apt安裝:官網上提供的命令是:$ sudo add-apt-repository ppa:git-core/ppa1中間暫停時,按回車鍵Enter繼續安裝。$ sudo apt-get update $ s

css3圖片處理方式 object-fit

含義 class 替換 down 區域 尺寸 屬性 obj over .fill { object-fit: fill; } .contain { object-fit: contain; } .cover { object-fit: cover; } .none { o