Skip to content
SaitoWu edited this page Jun 28, 2012 · 8 revisions

WHY U FORK THIS REPO

schacon/grack is a wonderful server to implement Git‘s smart http protocol.

But, i really need a convenient way to integrate this function.

So, I made a gem.

HOW TO USE THIS GEM

Create a config file called config/grack.yml this is a example file:

:project_root: /home/git/repositories/
:git_path: /usr/bin/git
:upload_pack: => true
:receive_pack: => true

Create a config.ru file:

  • If u just want to serve a git server without authentication:
require 'yaml'
require 'grack/server'

config = YAML.load_file("config/grack.yml")

run Grack::Server.new(config)
  • With Authentication:
require'grack'

module Grack
  class Auth < Rack::Auth::Basic

    # implement ur valid? method.
    def valid?
      false
    end
  end
end

config = YAML.load_file("config/grack.yml")
run Grack::Bundle.new(config)

INTEGRATE WITH RAILS

Gemfile:

gem 'grack', :git => git://github.com/SaitoWu/grack.git

routes.rb:

mount Grack::Bundle.new(YAML.load_file("config/grack.yml")), :at => '/git'

DONE

U have ur own http git server now!

Start ur rack server:

rackup -p 3000

Just try:

git clone http://localhost:3000/grack.git

Have Fun!

Clone this wiki locally