Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitlab6.0, Error Connection refused - connect(2) (Errno::ECONNREFUSED)

I installed gitlab

I installed gitlab, after reading

  • https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
  • https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/databases.md
  • ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3)
  • http://ubuntuforums.org/showthread.php?t=2061057
  • https://stackoverflow.com/questions/13018626/add-apt-repository-not-found

I make repository in gitlab on browser,
I set up ~/.ssh/config,
and
$ git push origin master

I got Erorr

/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.

I have read them, but I can not resolve this error.

(Maybe I am poor English, so I miss reading)

  • https://github.com/gitlabhq/gitlab-shell/issues/20
  • https://github.com/gitlabhq/gitlabhq/issues/3384
  • https://github.com/gitlabhq/gitlabhq/issues/4566

ssh -vT same Error

...
...
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 [email protected] 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

Why ssh useing Ruby?

Which setting use Ruby? How to resolve this error?

P.S.

I found which use 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 .....

so I command this

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

I got same Error

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>'

So, I have read /home/git/gitlab-shell/lib/gitlab_net.rb script.

gitlab_net.rb connect to

gitlab_net.rb connect to
https://my-server/api/v3/internal/discover?key_id=5
but I did not setup for https, so this is
This webpage is not available

http://my-server/api/v3/internal/discover?key_id=5 can connect to server.

I am so close.

setup ssl?

like image 288
shingo.nakanishi Avatar asked Aug 26 '13 14:08

shingo.nakanishi


2 Answers

I had the same problem yesterday with my gitlab setup and was able to fix it after reading this. Basically what you do is to edit the /etc/hosts file on your 'my-server' computer and add

127.0.0.1  your-gitlab-url
like image 58
chesedo Avatar answered Sep 23 '22 16:09

chesedo


As I can see it can be little mistake in /home/git/gitlab-shell/config.yml something like:

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

This address can be incorrect because gitlab-shell send request to Gitlab itself through http protocol and use this variable for connection.

like image 40
user2723489 Avatar answered Sep 24 '22 16:09

user2723489