2012-08-01 19 views
18

我有一個Git倉庫,我想查看到服務器上。有沒有一個廚師的食譜,這樣做?與廚師簽出一個Git存儲庫?

+0

這真的與Ruby有什麼關係,或者只是Git?檢出回購不會根據回購包含的內容進行更改。 – 2012-08-02 00:21:31

+0

安德魯,你說得對,這與紅寶石無關。 – 2012-08-02 00:45:42

+1

我想這是有用的信息:http://wiki.opscode.com/display/chef/Deploy+Resource – 2012-08-02 00:47:17

回答

41

該git SCM resource可能是你在找什麼。簡單的資源使用示例:

git "/path/to/check/out/to" do 
    repository "git://github.com/opscode/chef.git" 
    reference "master" 
    action :sync 
end 

如果要獲取特定分支,還請參閱「revision」屬性。

+5

描述'git'資源的鏈接: [http://docs.opscode.com/resource_git.html](http://docs.opscode.com/resource_git.html ) – OrPo 2013-05-16 12:51:43

+0

還應該注意,在使用git資源之前必須安裝git。在廚師的菜譜,您可以: '包「混帳」呢 措施:安裝 end' 或 'include_recipe「混帳:: default'' 確保您還添加了'取決於git'在metadata.rb文件如果與第二個選項一起去。 – Acorn 2016-02-25 19:21:57

+0

在答案中鏈接的參考文獻不再有效。請使用以下內容: https://docs.chef.io/resource_git.html – 2016-08-10 21:37:37