Skip to content

Instantly share code, notes, and snippets.

@cwjohnston
Forked from thommay/github.rb
Created June 23, 2011 16:55
Show Gist options
  • Save cwjohnston/1042983 to your computer and use it in GitHub Desktop.
Save cwjohnston/1042983 to your computer and use it in GitHub Desktop.
define :github, :user => "root", :home => "/root", :group => "" do
package "git-core"
group = params[:group].empty? ? params[:user] : params[:group]
directory "#{params[:home]}/.ssh" do
mode "0700"
owner params[:user]
group group
recursive true
end
cookbook_file "#{params[:home]}/.ssh/github" do
source "github-ssh-key"
mode "0600"
owner params[:user]
group group
end
file "#{params[:home]}/.ssh/config" do
owner params[:user]
group group
content <<-EOH
Host github.com
IdentityFile ~/.ssh/github
IdentitiesOnly yes
StrictHostKeyChecking no
EOH
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment