diff --git a/doc/install/installation.md b/doc/install/installation.md index 04a22a43..07ed0b0f 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -180,6 +180,14 @@ and ensure you have followed all of the above steps carefully. sudo gem install bundler sudo -u gitlab -H bundle install --without development test sqlite postgres --deployment +#### Configure git client + +Gitlab needs to be able to commit and push changes to gitolite. +Git requires a username and email in order to be able to do that. + + sudo -u gitlab -H git config --global user.email "gitlab@localhost" + sudo -u gitlab -H git config --global user.name "Gitlab" + #### Setup application sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index 1bef19a2..7ae34de6 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -194,8 +194,10 @@ module Gitlab def push tmp_dir Dir.chdir(File.join(tmp_dir, "gitolite")) - system('git add -A') - system('git commit -am "GitLab"') + raise "Git add failed." unless system('git add -A') + 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') Dir.chdir(Rails.root) else diff --git a/lib/tasks/gitlab/status.rake b/lib/tasks/gitlab/status.rake index 3878823c..508c41a2 100644 --- a/lib/tasks/gitlab/status.rake +++ b/lib/tasks/gitlab/status.rake @@ -37,9 +37,10 @@ namespace :gitlab do return end + FileUtils.rm_rf("/tmp/gitolite_gitlab_test") begin - `git clone #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite_gitlab_test` - FileUtils.rm_rf("/tmp/gitolite_gitlab_test") + `git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite_gitlab_test` + raise unless $?.success? print "Can clone gitolite-admin?............" puts "YES".green rescue @@ -48,6 +49,21 @@ namespace :gitlab do return end + begin + Dir.chdir("/tmp/gitolite_gitlab_test") do + `touch blah && git add blah && git commit -qm blah -- blah` + raise unless $?.success? + end + print "Can git commit?............" + puts "YES".green + rescue + print "Can git commit?............" + puts "NO".red + return + ensure + FileUtils.rm_rf("/tmp/gitolite_gitlab_test") + end + print "UMASK for .gitolite.rc is 0007? ............" if open(File.absolute_path("#{git_base_path}/../.gitolite.rc")).grep(/UMASK([ \t]*)=([ \t>]*)0007/).any? puts "YES".green