How to pull private git repo using chef from gitolite

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.

  • Jenkins CI with chef
  • Git pull on multiple servers
  • Chef Integration with Jenkins
  • How to create chef cookbook in git repository?
  • Installing a Ruby gem from a Github repository using Chef?
  • Git authentication in Chef
  • The command I execute is

    git clone gitoliteuser@myserver:MyProject.gr
    

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

  • Git clone fails with “SSLRead() return error -980641”
  • Does keeping (large-ish) binary files in a Git repository affect performance for operations besides cloning?
  • Git on Windows: Why I suddenly have untracked directory that used to be tracked?
  • GitFlow Unity3D and Branch specific Application Data
  • How do I change the git repo but keep the files?
  • GIT and VSTUDIO: Does visual studio cache files and cause issues when switching between GIT branches?
  • One Solution collect form web for “How to pull private git repo using chef from gitolite”

    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

    Git Baby is a git and github fan, let's start git clone.