2014-01-14 91 views
6

我很新手談到GIT。在這裏我試圖解釋我的錯誤情況。請以確切的命令幫助我。! [遠程拒絕]主 - >主(分支目前檢出)錯誤git

我必須在GIT遠程位置清空存儲庫。我只有權限克隆它們並將其更改推送給它們。我無權直接訪問GIT Remote。 回購是。 funder-sceduler.git和funder-request.git。 詳細爲他們的路徑:

  1. SSH://[email protected]/apps/git/web-platform/dotcms/modules/funder-request.git
  2. SSH:// [email protected]/apps/git/web-platform/dotcms/modules/funder-scheduler.git

現在我在本地克隆出資人,scheduler.git。我添加了我的更改。然後我做了一個GIT提交。 然後git push origin master。 它工作正常。

但是,當我的資助者,request.git做同樣的,運行命令「混帳推起源碩士後其拋出以下錯誤:

>$ git push origin master 
>Enter passphrase for key '/u/.ssh/id_rsa': 
>Counting objects: 81, done. 
>Compressing objects: 100% (61/61), done. 
>Writing objects: 100% (81/81), 215.86 KiB | 126.00 KiB/s, done. 
>Total 81 (delta 4), reused 0 (delta 0) 
>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 inconsist 
ent 
>remote: error: with what you pushed, and will require 'git reset --hard' to matc 
h 
>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 ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder- 
request.git 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to 'ssh://[email protected]/apps/git/we 
b-platform/dotcms/modules/funder-request.git' 

請求幫助我準確的命令來解決這個。 我不理解理論上的解釋,我很抱歉

回答

4

看起來funder-request.git不是裸露的回購,這意味着它有一個工作樹(來自結算分支的文件)。

請參閱「all about "bare" repos -- what, why, and how to fix a non-bare push」更多:
使用非裸露的回購協議需要與混帳回購協議本身的內容製作工作樹的內容不同步的風險。

您需要聯繫該服務器的管理員,並將其轉換爲裸露的回購。
請參閱「How to convert a git repository from normal to bare ?」。

+0

謝謝馮,它看起來很完美。 – user3052178

相關問題