How to pull private git repo using chef from gitolite

帅比萌擦擦* 提交于 2019-12-11 16:01:37

问题


I am new to using chef. I am able to clone/pull a github repository using the following code on my recipe

git "/var/www/hello_app" do
  repository "git://github.com/MyUser/MyProject.git"
  reference "master"
  action "sync"
  user "gituser"
end

I am trying to pull/clone my files from a private git repository managed my gitolite which means that authentication relies on sshd. I already have my id_rsa private key installed through a data_bag on gituser's .ssh/id_rsa file , the user who is pulling/cloning the private repo. Pulling/cloning the repository manually works.

The command I execute is

git clone gitoliteuser@myserver:MyProject.gr

How should I modify my recipe so I can pull my private repository ?


回答1:


The important part of the resource is the repository value. To use your gitolite repo, change the value to the one shown in your question:

git "/var/www/hello_app" do
  repository "gitoliteuser@myserver:MyProject.gr"
  reference "master"
  action "sync"
  user "gituser"
end

More details about using the git resource can be found on the opscode site here : http://docs.opscode.com/resource_git.html



来源:https://stackoverflow.com/questions/18713946/how-to-pull-private-git-repo-using-chef-from-gitolite

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!