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