Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git checkout in Chef recipe not working

I used the following chef stanza to try and checkout a github repository:

   git "/home/ubuntu" do
     repository "git://github.com/kmerenkov/brukva.git"
     revision "master"
     action :checkout
     user "ubuntu"
   end

The chef run has no errors and the resource is shown as up to date (even though no files are in the target directory).

* git[/home/ubuntu] action checkout (up to date)

What am I doing wrong?

like image 733
jhn gmsith Avatar asked Nov 08 '13 13:11

jhn gmsith


1 Answers

Try:

git "/home/ubuntu/brukva" do
  repository "git://github.com/kmerenkov/brukva.git"
  revision "master"
  action :sync
  user "ubuntu"
end

It does nothing if your target directory exists when using :checkout because it assumes your checkout is done already, you can see chef tells "up to date".

Refer to the source of git provider

like image 137
shawnzhu Avatar answered Oct 03 '22 22:10

shawnzhu