Apache-2.2

無法執行 grack,乘客出現錯誤:未初始化的常量 GitHttp (NameError)'

  • October 2, 2013

我嘗試設置 Web 伺服器以在成功安裝和工作的 redmine 伺服器上發布 git 儲存庫。

乘客發生錯誤:無法啟動 Web 應用程序



uninitialized constant GitHttp (NameError)
config.ru:16:in `block in <main>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in`instance_eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in`new'
config.ru:1:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in`eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in `preload_app'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:150:in`'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:28:in`'



/usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby

GitHttpgrack 的已發布版本(最後是 0.2)中的一個類,它在項目的 git master 分支中不再存在。

我懷疑您更新了 grack 程式碼以掌握 HEAD 而不更新config.ru. 您config.ru的 for master 應該是這樣的,並替換了項目路徑:

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')

use Rack::ShowExceptions

require 'grack'
require 'git_adapter'

config = {
 :project_root => "/path/to/your/repos/",
 :adapter => Grack::GitAdapter,
 :git_path => '/usr/bin/git',
 :upload_pack => true,
 :receive_pack => true,
}

run Grack::App.new(config)

引用自:https://serverfault.com/questions/543221