Commit 86807b8ecc1b6e6e55e297d52bd2c04375d1e3f1

Authored by Saito
1 parent 61b85aed

mount grack to git, u can 'git clone http://localhost/git/xx.git' now

config/gitlab.yml.example
... ... @@ -17,11 +17,15 @@ git_host:
17 17 base_path: /home/git/repositories/
18 18 host: localhost
19 19 git_user: git
  20 + upload_pack: true
  21 + receive_pack: true
20 22 # port: 22
21 23  
  24 +
22 25 # Git settings
23 26 # Use default values unless you understand it
24 27 git:
  28 + path: /usr/bin/git
25 29 # Max size of git object like commit, in bytes
26 30 # This value can be increased if you have a very large commits
27 31 git_max_size: 5242880 # 5.megabytes
... ...
config/initializers/grack_auth.rb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +module Grack
  2 + class Auth < Rack::Auth::Basic
  3 +
  4 + def valid?
  5 + true
  6 + end
  7 + end
  8 +end
... ...
config/routes.rb
... ... @@ -8,6 +8,14 @@ Gitlab::Application.routes.draw do
8 8 require 'resque/server'
9 9 mount Resque::Server.new, at: '/info/resque'
10 10  
  11 + # Enable Grack support
  12 + mount Grack::Bundle.new({
  13 + git_path: GIT_OPTS['path'],
  14 + project_root: GIT_HOST['base_path'],
  15 + upload_pack: GIT_HOST['upload_pack'],
  16 + receive_pack: GIT_HOST['receive_pack']
  17 + }), at: '/git'
  18 +
11 19 #
12 20 # Help
13 21 #
... ... @@ -20,15 +28,15 @@ Gitlab::Application.routes.draw do
20 28 # Admin Area
21 29 #
22 30 namespace :admin do
23   - resources :users do
24   - member do
  31 + resources :users do
  32 + member do
25 33 put :team_update
26 34 put :block
27 35 put :unblock
28 36 end
29 37 end
30   - resources :projects, :constraints => { :id => /[^\/]+/ } do
31   - member do
  38 + resources :projects, :constraints => { :id => /[^\/]+/ } do
  39 + member do
32 40 get :team
33 41 put :team_update
34 42 end
... ... @@ -79,12 +87,12 @@ Gitlab::Application.routes.draw do
79 87  
80 88 resources :wikis, :only => [:show, :edit, :destroy, :create] do
81 89 member do
82   - get "history"
  90 + get "history"
83 91 end
84 92 end
85 93  
86   - resource :repository do
87   - member do
  94 + resource :repository do
  95 + member do
88 96 get "branches"
89 97 get "tags"
90 98 get "archive"
... ... @@ -94,14 +102,14 @@ Gitlab::Application.routes.draw do
94 102 resources :deploy_keys
95 103 resources :protected_branches, :only => [:index, :create, :destroy]
96 104  
97   - resources :refs, :only => [], :path => "/" do
98   - collection do
  105 + resources :refs, :only => [], :path => "/" do
  106 + collection do
99 107 get "switch"
100 108 end
101 109  
102   - member do
  110 + member do
103 111 get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
104   - get "blob",
  112 + get "blob",
105 113 :constraints => {
106 114 :id => /[a-zA-Z.0-9\/_\-]+/,
107 115 :path => /.*/
... ... @@ -126,36 +134,36 @@ Gitlab::Application.routes.draw do
126 134 end
127 135 end
128 136  
129   - resources :merge_requests do
130   - member do
  137 + resources :merge_requests do
  138 + member do
131 139 get :diffs
132 140 get :automerge
133 141 get :automerge_check
134 142 end
135 143  
136   - collection do
  144 + collection do
137 145 get :branch_from
138 146 get :branch_to
139 147 end
140 148 end
141   -
142   - resources :snippets do
143   - member do
  149 +
  150 + resources :snippets do
  151 + member do
144 152 get "raw"
145 153 end
146 154 end
147 155  
148   - resources :hooks, :only => [:index, :create, :destroy] do
149   - member do
  156 + resources :hooks, :only => [:index, :create, :destroy] do
  157 + member do
150 158 get :test
151 159 end
152 160 end
153   - resources :commits do
154   - collection do
  161 + resources :commits do
  162 + collection do
155 163 get :compare
156 164 end
157 165  
158   - member do
  166 + member do
159 167 get :patch
160 168 end
161 169 end
... ...