diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 20fd5ba92a10e9048acaee412b851f7cce4db5ce..552f7eaa5ce7d1ed8cf52978fbf27dedc8a1eab4 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -72,8 +72,7 @@ module Backup
       end
 
       print 'Put GitLab hooks in repositories dirs'.yellow
-      gitlab_shell_user_home = File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
-      if system("#{gitlab_shell_user_home}/gitlab-shell/support/rewrite-hooks.sh", Gitlab.config.gitlab_shell.repos_path)
+      if system("#{Gitlab.config.gitlab_shell.path}/support/rewrite-hooks.sh", Gitlab.config.gitlab_shell.repos_path)
         puts " [DONE]".green
       else
         puts " [FAILED]".red