Commit 34e3327357f04e29ee72042881e827352dbf1c04

Authored by Dmitriy Zaporozhets
2 parents 0590aa9d 19f7b038

Merge pull request #1154 from meskyanichi/master

As per request: Post-receive hook should be owned by gitlab user, not git.
Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
lib/tasks/gitlab/backup.rake
@@ -142,8 +142,12 @@ namespace :gitlab do @@ -142,8 +142,12 @@ namespace :gitlab do
142 print "- Restoring repository #{project.first}... " 142 print "- Restoring repository #{project.first}... "
143 FileUtils.rm_rf(project.second) if File.dirname(project.second) # delet old stuff 143 FileUtils.rm_rf(project.second) if File.dirname(project.second) # delet old stuff
144 if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") 144 if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1")
145 - Kernel.system("sudo chmod -R g+rwX #{Gitlab.config.git_base_path}")  
146 - Kernel.system("sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}") 145 + permission_commands = [
  146 + "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
  147 + "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}",
  148 + "sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive"
  149 + ]
  150 + permission_commands.each { |command| Kernel.system(command) }
147 puts "[DONE]".green 151 puts "[DONE]".green
148 else 152 else
149 puts "[FAILED]".red 153 puts "[FAILED]".red