2010-08-15 114 views
1

我有一個遠程Web服務器,我有充分的權限(SSH,GIT等)。我希望能夠編輯我的計算機上的文件並將它們推送到遠程服務器。當我使用純倉庫就不會改變文件,但是當我使用非純倉庫將其與以下消息抱怨:Git遠程倉庫(帶文件?)

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 t 
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int 
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 som 
remote: error: other way. 
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, se 
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. 

有沒有什麼辦法讓兩個我的筆記本電腦和工作副本遠程服務器?

感謝

回答

3

您可以設置選項(在服務器上):

git config receive.denyCurrentBranch ignore 

或者使用在服務器端兩個儲存。一個是你推送到的裸倉庫。另一個是非裸倉庫,它是裸倉庫的「工作副本」克隆。您將裸回購一個後提交鉤子cd s到您的工作副本並執行git pull

+0

我希望我能兩次投票!我不知道後提交的鉤子,這聽起來很適合我需要的東西(我不想讓自己的解決方案完成鉤子功能的工作)。 – 2010-08-16 15:20:32

+0

不錯的提示,與鉤。 – Asturio 2012-05-03 13:51:41