2011-08-04 174 views
0

我是新來的混帳,我有問題 我在推送數據在我的混帳系統有問題。 我安裝了Git和gitolite但是當我打電話:「混帳推起源大師」它給了我這個錯誤:centos5 git共享文件夾

Counting objects: 12, done. 
Compressing objects: 100% (9/9), done. 
Writing objects: 100% (12/12), 1.47 KiB, done. 
Total 12 (delta 1), reused 5 (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]:gitolite-admin 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to '[email protected]:gitolite-admin' 

我跟着這個教程安裝gitolite:但gitolink 一切都按我應該是在最後步。當我執行命令,我可悲得到這個錯誤

任何人都可以告訴我該怎麼辦或如何解決這個問題? 已經thried: 混帳配置--bool core.bare真正 改變分支(這樣(主)不使用)

+0

可能重複[無法推入到git存儲庫](http://stackoverflow.com/questions/3221859/cannot-push-into-git-repository) –

回答

0

最根本的問題是,你要推到一個「無-bare「git存儲庫。雖然這是可能的,但很多文檔和書籍都沒有清楚表明這不被推薦。

因此而Git是一個分散/衆高手SCM,在實踐中,你往往有什麼「大師」或從克隆,推動,並作爲「規範」,「中央」資源庫回購和工作回購(例如在您的筆記本電腦上),您從「主」中克隆出來,您將改爲,並從

server$ cd ; mkdir git 
server$ git clone --bare /home/user/foo /home/user/git/foo.git 

一旦你做到了這一點,你就可以從你的筆記本電腦推:這些「大師」庫中,應當與--bare創建

laptop$ cd foo 
laptop$ git remote -v 
laptop$ origin [email protected]:/home/user/git/foo.git (fetch) 
laptop$ origin [email protected]:/home/user/git/foo.git (push) 
laptop$ git push origin master 

你也可以做服務器:

git config --global receive.denyCurrentBranch "ignore" 

但我不會這樣做,直到你更好地理解git如何工作。

+0

我得到的錯誤起源不是一個命令 當我跳過以原點開始的行(轉到git push) 我檢索錯誤:origin似乎不是git存儲庫 – thanksalot