Commit 31bd4a964820e26eec3883696f47595d27662f03

Authored by Jacob Vosmaer
1 parent a93f8709

Create a global .gitconfig for the git user

files/gitlab-cookbooks/gitlab/attributes/default.rb
... ... @@ -31,6 +31,8 @@ default['gitlab']['user']['group'] = "git"
31 31 default['gitlab']['user']['shell'] = "/bin/sh"
32 32 # The home directory for the chef services user
33 33 default['gitlab']['user']['home'] = "/var/opt/gitlab"
  34 +default['gitlab']['user']['git_user_name'] = "GitLab"
  35 +default['gitlab']['user']['git_user_email'] = "gitlab@#{node['fqdn']}"
34 36  
35 37  
36 38 ####
... ...
files/gitlab-cookbooks/gitlab/recipes/users.rb
... ... @@ -16,12 +16,21 @@
16 16 #
17 17  
18 18 gitlab_username = node['gitlab']['user']['username']
  19 +gitlab_home = node['gitlab']['user']['home']
19 20  
20 21 group gitlab_username
21 22  
22 23 # Create a user for Chef services to run as
23 24 user gitlab_username do
24 25 shell node['gitlab']['user']['shell']
25   - home node['gitlab']['user']['home']
  26 + home gitlab_home
26 27 gid gitlab_username
27 28 end
  29 +
  30 +template File.join(gitlab_home, ".gitconfig") do
  31 + source "gitconfig.erb"
  32 + owner gitlab_username
  33 + group node['gitlab']['user']['group']
  34 + mode "0644"
  35 + variables(node['gitlab']['user'].to_hash)
  36 +end
... ...
files/gitlab-cookbooks/gitlab/templates/default/gitconfig.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +[user]
  2 + name = <%= node['gitlab']['user']['git_user_name'] %>
  3 + email = <%= node['gitlab']['user']['git_user_email'] %>
  4 +[core]
  5 + autocrlf = input
... ...