2011-02-04 111 views
1

好吧,我在我的機器上安裝了一個repo安裝程序,我正在使用它來將更新推送到文件服務器上的某個位置。我用下面的克隆:使用GIT更新本地文件服務器上的文件

機器上的dir開始:

git init 
git add . 
git commit -m 'initial' 
cd ../ 

然後克隆到文件服務器

git clone -bare testdir fileserverip/testdir 

此克隆很好,但我該如何使用GIT更新?與我以前使用GIT的經驗不同,我不想通過SSH或其他方式進行連接,因此如何設置推送?

編輯:

的Makis在答覆中提到修改我的設置後,我得到git push

james-macbook:test2 james$ git push 
Counting objects: 6, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (4/4), done. 
Writing objects: 100% (4/4), 506 bytes, done. 
Total 4 (delta 1), reused 0 (delta 0) 
Unpacking objects: 100% (4/4), done. 
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 xxxxxxxxxxxxxxxxxxx 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to 'xxxxxxxxxxxxxxxxxxx' 
james-macbook:test2 james$ 

任何人以下錯誤知道這意味着什麼?

編輯:剛發現這個,認爲這是我所需要的。 http://tiredblogger.wordpress.com/2009/11/09/creating-local-git-repositories-yeah-its-that-simple/

感謝

+0

只是認爲這可能更適合ServerFault。不確定? – 2011-02-04 15:37:45

+0

這個問題看起來像你的遠程回購不光。 – Makis 2011-02-04 17:33:45

回答

1

如果你可以掛載通過NFS或桑巴,易peasy服務器目錄。我會先在服務器上創建裸倉庫。然後克隆機器上的空存儲庫並添加東西。

之後,一切正常(拉,推)。

+0

嘿謝謝,我會給你一個去。 – 2011-02-04 15:42:10

0

這聽起來像是你試圖做一些非常類似於推送到git存儲庫部署網站的常見問題的東西,所以關於如何做到這一點的信息應同樣適用於這種情況。

http://toroid.org/ams/git-website-howto

該網頁介紹了設定純倉庫(FYI在命令你上面列出你有-bare代替--bare這可能是您所遇到的一個問題),並使用後收到鉤來更新目錄的內容自動。 post-receive hook通過調用git checkout -f來完成此操作,但是指定了一個明確的工作樹(裸存儲庫沒有工作樹,因此通常命令會失敗)。

相關問題