Sha256: c91ccc508c84836ac2aaddcd84184fe501ea1d7459c92ee886b4c72dda36e8bc

Contents?: true

Size: 1.67 KB

Versions: 20

Compression:

Stored size: 1.67 KB

Contents

# Copyright 2006-2008 by Mike Bailey. All rights reserved.
Capistrano::Configuration.instance(:must_exist).load do 
  namespace :deprec do 
    namespace :gitosis do
      
      # ref: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

      set :gitosis_user, 'git'

      desc "Install git"
      task :install do
        deprec2.create_src_dir
        install_deps
        run <<-SUDO
          cd #{src_dir} && test -d gitosis || #{sudo} git clone git://eagain.net/gitosis.git; exit 0
        SUDO
        run "cd #{src_dir}/gitosis && #{sudo} python setup.py install"
        create_user
        init
      end

      # install dependencies for nginx
      task :install_deps do
        apt.install( {:base => %w(python-setuptools)}, :stable )
      end

      # Create user for gitosis to run as
      # This will also be the account you use for ssh access to git
      task :create_user do
        run "grep '^#{gitosis_user}:' /etc/passwd || #{sudo} adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/#{gitosis_user} #{gitosis_user}"
        sudo "passwd --unlock #{gitosis_user}"
      end
      
      task :init do
        sudo "sudo -H -u #{git_user} gitosis-init < ~/.ssh/authorized_keys"
        sudo "chmod 0755 /home/git/repositories/gitosis-admin.git/hooks/post-update" 
        puts
        puts "Now check out the gitosis-admin repos, edit configs and push changes back"
        puts "Your changes with update gitosis as soon as they are checked in."
        puts
        puts "git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git"
        puts "cd gitosis-admin"
        puts ""
      end

    end 
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
andyh-deprec-1.99.26 lib/deprec/recipes/gitosis.rb
andyh-deprec-1.99.27 lib/deprec/recipes/gitosis.rb
isaac-deprec-1.99.30 lib/deprec/recipes/gitosis.rb
isaac-deprec-1.99.32 lib/deprec/recipes/gitosis.rb
deprec-2.1.1 lib/deprec/recipes/gitosis.rb
deprec-2.1.0 lib/deprec/recipes/gitosis.rb
deprec-2.0.15 lib/deprec/recipes/gitosis.rb
deprec-2.0.11 lib/deprec/recipes/gitosis.rb
deprec-2.0.13 lib/deprec/recipes/gitosis.rb
deprec-2.0.1 lib/deprec/recipes/gitosis.rb
deprec-2.0.10 lib/deprec/recipes/gitosis.rb
deprec-2.0.0 lib/deprec/recipes/gitosis.rb
deprec-2.0.7 lib/deprec/recipes/gitosis.rb
deprec-2.0.6 lib/deprec/recipes/gitosis.rb
deprec-2.0.2 lib/deprec/recipes/gitosis.rb
deprec-2.0.8 lib/deprec/recipes/gitosis.rb
deprec-2.0.5 lib/deprec/recipes/gitosis.rb
deprec-2.0.4 lib/deprec/recipes/gitosis.rb
deprec-2.0.3 lib/deprec/recipes/gitosis.rb
deprec-2.0.9 lib/deprec/recipes/gitosis.rb