Skip to content

Instantly share code, notes, and snippets.

@thbar
Created February 15, 2012 11:23
Show Gist options
  • Save thbar/1835161 to your computer and use it in GitHub Desktop.
Save thbar/1835161 to your computer and use it in GitHub Desktop.
How I got git working with chef on windows
include_recipe "windows::default"
include_recipe "windows::git"
=begin
# Doesn't work (yet?), see http://tickets.opscode.com/browse/CHEF-2931
git node.app.deploy_to do
repository node.app.git.repository
reference node.app.git.reference
action :sync
end
=end
# using plain "git" won't seem to catch git.exe even if in the path, both for the git or the execute resource
git_command = [node.git.install_path, 'bin', 'git.exe'].join("\\")
# very basic, no symlink, no branch management etc git clone/pull work-around
execute "git clone" do
command "#{git_command} clone #{node.app.git.repository} #{node.app.deploy_to}"
creates node.app.deploy_to
end
execute "git pull" do
command "#{git_command} pull"
cwd node.app.deploy_to
only_if { File.exist?(node.app.deploy_to) }
end
gem_package 'bundler' do
version '1.0.22'
action :install
end
# extra recipe for git
windows_package "Git" do
source node.git.source
installer_type :inno
action :install
options "/DIR=\"#{node.git.install_path}\""
not_if { File.exist?(File.join(node.git.install_path, 'bin', 'git.exe')) }
end
{
"run_list": [
"application::default"
],
"git": {
"install_path": "c:\\git",
"source": "http://msysgit.googlecode.com/files/Git-1.7.9-preview20120201.exe"
},
"app": {
"deploy_to": "c:\\app",
"git": {
"repository": "git@xxxx:/repo.git"
}
}
}
@johnypony3
Copy link

thanks! had no idea about inno this works.
it would be most awesome if the env path was set. as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment