【问题标题】:gitlab6.0, Error Connection refused - connect(2) (Errno::ECONNREFUSED)gitlab6.0,错误连接被拒绝 - 连接(2)(Errno::ECONNREFUSED)
【发布时间】:2013-08-29 02:14:51
【问题描述】:

我安装了 gitlab

我安装了gitlab,看完

我在浏览器的 gitlab 中创建存储库,
我设置了~/.ssh/config,
和
$ git push origin master

我出错了

/usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:17:in `allowed?'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:60:in `validate_access'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:23:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>'
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我已阅读它们,但我无法解决此错误。

(可能是我英文不好,所以想念书)

ssh -vT 相同的错误

...
...
debug1: Sending env LC_CTYPE = UTF-8
debug1: Sending env LANG = ja_JP.UTF-8
/usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:24:in `discover'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:77:in `user'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:82:in `username'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:36:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2560, received 3808 bytes, in 0.4 seconds
Bytes per second: sent 7260.5, received 10799.9
debug1: Exit status 1

为什么 ssh 使用 Ruby?

哪个设置使用 Ruby? 如何解决这个错误?

附言

我找到了使用 ruby​​ 的。

/home/git/.ssh/authorized_keys

command="/home/git/gitlab-shell/bin/gitlab-shell key-4",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa .....

所以我命令这个

$ /home/git/gitlab-shell/bin/gitlab-shell key-4

我遇到了同样的错误

usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:24:in `discover'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:77:in `user'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:82:in `username'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:36:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>'

所以,我已经阅读了/home/git/gitlab-shell/lib/gitlab_net.rb 脚本。

gitlab_net.rb 连接到

gitlab_net.rb 连接到
https://my-server/api/v3/internal/discover?key_id=5
但我没有设置 https,所以这是
This webpage is not available

http://my-server/api/v3/internal/discover?key_id=5 可以连接到服务器。

我很接近。

设置 ssl?

【问题讨论】:

    标签: ruby-on-rails git ssh gitlab


    【解决方案1】:

    昨天我的 gitlab 设置遇到了同样的问题,并且在阅读 this 后能够修复它。基本上你所做的是在你的“我的服务器”计算机上编辑/etc/hosts 文件并添加

    127.0.0.1 your-gitlab-url

    【讨论】:

      【解决方案2】:

      我可以看到 /home/git/gitlab-shell/config.yml 中的小错误 类似:

      gitlab_url: "http://gitlab.somedomain.com:8080/"

      此地址可能不正确,因为 gitlab-shell 通过 http 协议向 Gitlab 本身发送请求并使用此变量进行连接。

      【讨论】:

        【解决方案3】:

        你可能应该设置:

        gitlab_url: to http://localhost/
        

        这与以下内容基本相同: 127.0.0.1 你的-gitlab-url 否则:internal/discover 等将收到 401

        更新: 请参见: https://github.com/gitlabhq/gitlabhq/issues/4730#issuecomment-26332619 使用

        gitlab_url: to http://127.0.0.1
        

        应该没问题

        【讨论】:

          【解决方案4】:

          检查nginx是否正常运行。

          sudo nginx -t

          可能存在“检测到重复的默认服务器”之类的问题 并且需要删除该默认文件。

          修复错误后,发出命令

          sudo service nginx restart

          在/home/git/gitlab下重新运行检查命令

          sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-04-01
            • 2011-12-02
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-08-15
            • 1970-01-01
            相关资源
            最近更新 更多