2014-02-12 102 views
0

我會告訴你我在做什麼服務器上循序漸進(Ubuntu服務器12.04)和地方(Ubuntu的12.04):無法創建第二個庫混帳

服務器:(BTW)

mkdir foo 
cd foo 
git init 

pwd /home/andrzej/repository/foo

一切正常:-)。

地方:

mkdir test 
cd test 
git clone [email protected]:/home/andrzej/repository/foo 
(password) 
cd foo 
(copy some file - e.g. fake.txt) 
git add * 
git commit -m "Add fake file" 

一切好:-)。

現在:

git push origin master 
(password) 

ERROR : 
Counting objects: 3, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (3/3), done. 
Writing objects: 100% (3/3), 1.33 KiB, done. 
Total 3 (delta 0), 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 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]:/home/andrzej/repository/foo 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to '[email protected]:/home/andrzej/repository/foo' 

我做錯了嗎? 我可以補充說,前一段時間我創建了一個名爲「repogit」 的存儲庫,只是爲了測試,一切都很好。 (git init ...一步一步)。現在我想創建第二個回購。我收到上述錯誤。也許這個 是問題?我無法創建第二個回購?

+0

您正在推送到非裸存儲庫。在推動之後,你期望在索引中會發生什麼? – zerkms

+0

我想創建一個正常的回購,我將能夠更新和提交文件。 所以我必須在服務器端添加?我試圖用光禿禿的,但沒有任何影響。 – andrew

+0

http://stackoverflow.com/a/2200662/251311 http://stackoverflow.com/q/7632454/251311 – zerkms

回答

1

原始存儲庫應該是裸露的,方便您輕鬆完成。

這意味着,它應該已經與--bare選項初始化:

git --bare init 

否則就可以使現有的存儲庫裸下面從this answer的說明。