Mark parent directories for git repositories as safe
authorTom Hughes <tom@compton.nu>
Tue, 17 May 2022 07:20:29 +0000 (08:20 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 17 May 2022 07:20:29 +0000 (08:20 +0100)
cookbooks/git/recipes/server.rb
cookbooks/git/templates/default/gitconfig.erb [new file with mode: 0644]

index 9b4e06a4514c0b8b0114ce972e46d8e2dbc532eb..bd586e9f2c0e34165aef4fedced19cbee48bf76a 100644 (file)
@@ -43,6 +43,13 @@ directory "#{git_directory}/private" do
   mode "2775"
 end
 
+template "/etc/gitconfig" do
+  source "gitconfig.erb"
+  owner "root"
+  group "root"
+  mode "644"
+end
+
 Dir.glob("#{git_directory}/*/*.git").each do |repository|
   template "#{repository}/hooks/post-update" do
     source "post-update.erb"
diff --git a/cookbooks/git/templates/default/gitconfig.erb b/cookbooks/git/templates/default/gitconfig.erb
new file mode 100644 (file)
index 0000000..52d3dbf
--- /dev/null
@@ -0,0 +1,5 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+[safe]
+       directory = /var/lib/chef/public
+       directory = /var/lib/chef/private