Skip to content

Commit

Permalink
Merge pull request gitlabhq#1154 from meskyanichi/master
Browse files Browse the repository at this point in the history
As per request: Post-receive hook should be owned by gitlab user, not git.
  • Loading branch information
dzaporozhets committed Jul 27, 2012
2 parents 0590aa9 + 19f7b03 commit 34e3327
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tasks/gitlab/backup.rake
Expand Up @@ -142,8 +142,12 @@ namespace :gitlab do
print "- Restoring repository #{project.first}... "
FileUtils.rm_rf(project.second) if File.dirname(project.second) # delet old stuff
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")
Kernel.system("sudo chmod -R g+rwX #{Gitlab.config.git_base_path}")
Kernel.system("sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}")
permission_commands = [
"sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
"sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}",
"sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive"
]
permission_commands.each { |command| Kernel.system(command) }
puts "[DONE]".green
else
puts "[FAILED]".red
Expand Down

0 comments on commit 34e3327

Please sign in to comment.