5

I installed gitlab

I installed gitlab, after reading

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)

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

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?

Community
  • 1
  • 1
shingo.nakanishi
  • 2,045
  • 2
  • 21
  • 55

4 Answers4

4

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
chesedo
  • 171
  • 1
  • 8
1

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.

0

you probably should set:

gitlab_url: to http://localhost/

which is essential the same as: 127.0.0.1 your-gitlab-url otherwise: internal/discover etc. will receive 401

UPDATE: please see: https://github.com/gitlabhq/gitlabhq/issues/4730#issuecomment-26332619 use

gitlab_url: to http://127.0.0.1

should work fine

Bigreat
  • 1
  • 1
  • 2
0

Check whether nginx is running properly.

sudo nginx -t

Maybe there are problems like "a duplicate default server is detected" and that default file is required to be removed.

After fixing the error(s), issue command

sudo service nginx restart

Rerun the check command under /home/git/gitlab

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

Ivan Chau
  • 1,403
  • 1
  • 18
  • 28