GitLab shell错误#<socketerror:getaddrinfo:=“”name =“”或=“”service =“”not =“”known =“”>

时间:2015-09-11 12:30:39

标签: gitlab

Gitlab服务器由Nginx在本地网络上安装在CentOs 6.7上。我可以通过浏览器登录服务器,添加用户,项目等。但用户无法通过Windows GIT Bash推送/拉取自己的项目: $ git push -u origin master

GitLab: Failed to authorize your Git request: internal API unreachable ...

为了澄清服务器端的情况我已经运行:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production显示错误:

...
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED: Failed to connect to internal API
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.
...

我的/home/git/gitlab-shell/config.yml:

user: git
gitlab_url: "https://git/"
http_settings:
  self_signed_cert: false
ca_file: "/etc/nginx/ssl/gitlab.crt"
ca_path: "/etc/nginx/ssl"
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
  bin: "/usr/bin/redis-cli"
  namespace: resque:gitlab
  socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

gitlab-shell.log中的错误消息是:

WARN -- : Failed to connect to internal API <GET https://git//api/v3/internal/check>: 
#<SocketError: getaddrinfo: Name or service not known>

git别名是在/ etc / hosts中编写的,并且工作正常(ping成功)。 cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 
192.168.1.21  git
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

如果我在gitlab-shell/config.yml中将git更改为localhost,我将进入日志:

WARN -- : Failed to connect to internal API <GET https://localhost//api/v3/internal/check>: 
#<OpenSSL::SSL::SSLError: hostname "localhost" does not match the server certificate>

如果我将git更改为IP表示法192.168.1.21我会得到:

WARN -- : Failed to connect to internal API <POST https://192.168.1.21//api/v3/internal/allowed>: 
#<SocketError: getaddrinfo: Name or service not known>

SSL是正常的。用户证书已设置。在客户端ssh -T git@git输出

Welcome to GitLab,...

用户可以通过浏览器等登录https://git服务器。

其他信息:sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

System information
System:         CentOS 6.7
Current User:   git
Using RVM:      no
Ruby Version:   2.2.3p173
Gem Version:    2.4.8
Bundler Version:1.10.6
Rake Version:   10.4.2
Sidekiq Version:3.3.0

GitLab information
Version:        7.14.1
Revision:       348b983
Directory:      /home/git/gitlab
DB Adapter:     mysql2
URL:            https://git
HTTP Clone URL: https://git/some-group/some-project.git
SSH Clone URL:  git@git:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        2.6.4
Repositories:   /home/git/repositories/
Hooks:          /home/git/gitlab-shell/hooks/
Git:            /usr/bin/git

你能否给我解决问题的想法(这个问题的很多答案提供给{etc / host添加localhost 127.0.0.1,但我的这个文件的版本是否包含它?)

P.S。 更改gitlab_url:&#34; https://git/&#34;到gitlab_url:&#34; https://git&#34;或&#34; https://git:8080/&#34;不解决问题。我们在日志中跟踪了msg:

WARN -- : Failed to connect to internal API <GET https://git/api/v3/internal/check>: 
#<SocketError: getaddrinfo: Name or service not known etc

P.S.S。编辑/gitlab-shell/config.yml

解决了问题
gitlab_url: "https://localhost/"
http_settings:
self_signed_cert: true

仅显示self_signed_cert&amp;的组合。 gitlab_url可以帮助解决我的问题。

1 个答案:

答案 0 :(得分:0)

编辑/gitlab-shell/config.yml

解决了问题
gitlab_url: "https://localhost/"
http_settings:
self_signed_cert: true

仅显示self_signed_cert&amp;的组合。 gitlab_url可以帮助解决我的问题。