I have been trying to deploy master branch on my production servers with chef, using git_resource. Apparently it always deploys the code from the deploy branch which actually does not exist in the main git repo.
I am using deploy keys with only read mode.
git '/path/to/the/dir/' do
repository '[email protected]:example/example.git'
revision 'master'
checkout_branch 'master'
enable_checkout true
action :sync
user 'ubuntu'
group 'ubuntu'
end
Do help me out, to resolve this issue.
The way the git resource works is grab the SHA for whatever you give in revision
, check it out to the working copy, and then set a head named deploy
(or whatever checkout_branch
is set to) to the SHA. This allows efficient checking of updates without leaving the repo in a detached head state. So basically just remove the checkout_branch 'master'
and you'll get a repo sync'd to master
every time Chef runs. Setting revision
and checkout_branch
to the same value breaks the idempotence check.