diff --git a/app/views/errors/gitolite.html.haml b/app/views/errors/gitolite.html.haml
index 590bca71dd42a4d42d91d01135c45fdc596ad745..33ea8c1a8b74e64fc683ac1f8335a44d71e52105 100644
--- a/app/views/errors/gitolite.html.haml
+++ b/app/views/errors/gitolite.html.haml
@@ -15,7 +15,7 @@
%p
Diagnostic tool:
%pre
- bundle exec rake gitlab:app:status RAILS_ENV=production
+ bundle exec rake gitlab:check RAILS_ENV=production
%li
%p
Permissions:
diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb
index 10e527eac73ebf55884b0296a365685097bb8fce..720ef8d236b7c92aae4e75fa90518a6b242e79f7 100644
--- a/lib/gitlab/backend/gitolite_config.rb
+++ b/lib/gitlab/backend/gitolite_config.rb
@@ -6,6 +6,7 @@ module Gitlab
class GitoliteConfig
class PullError < StandardError; end
class PushError < StandardError; end
+ class BrokenGitolite < StandardError; end
attr_reader :config_tmp_dir, :ga_repo, :conf
@@ -72,6 +73,10 @@ module Gitlab
log("Push error -> " + " " + ex.message)
raise Gitolite::AccessDenied, ex.message
+ rescue BrokenGitolite => ex
+ log("Gitolite error -> " + " " + ex.message)
+ raise Gitolite::AccessDenied, ex.message
+
rescue Exception => ex
log(ex.class.name + " " + ex.message)
raise Gitolite::AccessDenied.new("gitolite timeout")
@@ -202,7 +207,15 @@ module Gitlab
system('git commit -m "GitLab"') # git commit returns 0 on success, and 1 if there is nothing to commit
raise "Git commit failed." unless [0,1].include? $?.exitstatus
- if system('git push')
+ stdin, stdout, stderr = Open3.popen3('git push')
+ push_output = stderr.read
+ push_status = $?.to_i
+
+ if push_output =~ /remote\: FATAL/
+ raise BrokenGitolite, push_output
+ end
+
+ if push_status.zero?
Dir.chdir(Rails.root)
else
raise PushError, "unable to push gitolite-admin repo"