连接拒绝来自Ruby的Git

时间:2013-03-25 18:25:08

标签: ruby git gitlab

当我试图将某些内容推送到我的gitlab的geosurvey.git回购时,我收到此错误:

enter image description here

git@192.168.31.128:geosurvey.git: /usr/local/lib/ruby/1.9.1/net/http.rb:762!in `initialize': Connection refused(2) (Errno:ECONNREFUSED)
  from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `open'
  from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
  from /usr/local/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  from /usr/local/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  from /usr/local/lib/ruby/1.9.1/net/http.rb:762:in `connect'
  from /usr/local/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  from /usr/local/lib/ruby/1.9.1/net/http.rb:744:in `start'
  from /home/git/gitlab-shell/lib/gitlab_net.rb:56:in `get'
  from /home/git/gitlab-shell/lib/gitlab_net.rb:17:in `allowed?'
  from /home/git/gitlab-shell/lib/gitlab_shell.rb:51:in `validate_access'
  from /home/git/gitlab-shell/lib/gitlab_shell.rb:21:in `exec'
  from /home/git/gitlab-shell/lib/gitlab_shell.rb:16:in `<main>'

以上错误适用于此代码:

def connect
      D "opening connection to #{conn_address()}..."
      s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
      D "opened"
      if use_ssl?
        ssl_parameters = Hash.new
        iv_list = instance_variables
        SSL_ATTRIBUTES.each do |name|
          ivname = "@#{name}".intern
          if iv_list.include?(ivname) and
             value = instance_variable_get(ivname)
            ssl_parameters[name] = value
          end
        end
        @ssl_context = OpenSSL::SSL::SSLContext.new
        @ssl_context.set_params(ssl_parameters)
        s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
        s.sync_close = true
end

我的gitlab.yml或/ etc / nginx / sites-available / gitlab可能有问题吗?

谢谢,


问题是我无法与远程gitlab服务器建立ssh连接。我的ssh端口是22(默认),我的gitlab端口是3222。

2 个答案:

答案 0 :(得分:1)

gitlab的安装指南缺少必须如何配置监听端口。

现在,通过这一行,我可以推送和克隆任何存储库。

listen *:80 default_server;         # e.g., listen 192.168.1.1:80;

答案 1 :(得分:0)

  

问题是我无法与远程gitlab服务器建立ssh连接。我的ssh端口是22(默认),我的gitlab端口是3222。

然后,在使用ssh Gitlab网址时,您需要确保使用端口3222 您可以在配置文件中指定自定义端口号,如this question中所示,也在“Using a remote repository with non-standard port”中说明,scp-style。
或者直接在ssh url中指定端口:

ssh://[user@]host.xz[:port]/path/to/repo.git/