在這裏,我下面的例子中 http://wiki.dreamhost.com/GitGit的初始化--bare - 對工作樹
基本上我想創建一個混帳回購協議,我可以推到一個服務器上,從我的桌面... 在主機不工作:
[host ~]$ mkdir project.git
[host ~]$ cd project.git
[host project.git]$ git init --bare
[host project.git]$ exit
然後在本地:
[local ~]$ cd project
[local project]$ git init
[local project]$ touch .gitignore
[local project]$ git add .
[local project]$ git commit
,如果我的CD到目錄..我出以下文件主機(通常這LY坐在git的目錄)
HEAD branches config description hooks info objects refs
在本地然後創建一個遠程推送: git的遠程添加初始的ssh:// @ XXX XXX /家庭/ XXX/XXX/ 它推說,它一直...
Counting objects: 3, done.
Writing objects: 100% (3/3), 210 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
但是,當我回到服務器上的工作文件夾,沒有什麼..它只是上面列出的.git文件。
我以前做過這件事,它的工作方式是這樣的......只是這次我必須做錯事。
UPDATE
如果我試圖建立一個沒有--bare服務器上的回購...然後我得到推送
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'.
更新並解決此錯誤....
我發現這其中的作品真的很好 http://toroid.org/ams/git-website-howto
基本上使用一個--bare然後有鉤子複製你的最新提交到工作目錄!
你會做什麼? – 2012-07-17 15:11:29
取決於用例 - 我的許多項目都有一個正常的存儲庫,還有一個我將其作爲備份推向的裸露存儲庫。有幾個擁有多個工作目錄的普通存儲庫,所以我可以在任何地方工作,但我通常不會從這些工作目錄推送 - 而是通過取/合併來獲取更新。通常在這些情況下,我也會有一個裸倉庫來推動備份。 – twalberg 2012-07-17 15:16:35
好吧,我真正想要的是一個遠程回購,一個本地。所以我可以用git推動遠程主服務器將代碼從本地服務器遷移到服務器 – 2012-07-17 15:18:57