Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;连接被拒绝-连接(2)(错误号::ECONREFUSSED)";从gitlab推送到远程git服务器时_Git_Push_Gitlab - Fatal编程技术网

&引用;连接被拒绝-连接(2)(错误号::ECONREFUSSED)";从gitlab推送到远程git服务器时

&引用;连接被拒绝-连接(2)(错误号::ECONREFUSSED)";从gitlab推送到远程git服务器时,git,push,gitlab,Git,Push,Gitlab,我从以下方面开始gitlab: rvmsudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production 创建新项目时,我会得到远程回购url: git remote add origin ssh://git@gitlab.mydomain.com:12035/root/my_project.git (so not the default 22 ssh port, but 12035) 因此,当我尝试将其推送到gitlab时:

我从以下方面开始gitlab:

rvmsudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
创建新项目时,我会得到远程回购url:

git remote add origin ssh://git@gitlab.mydomain.com:12035/root/my_project.git

(so not the default 22 ssh port, but 12035)
因此,当我尝试将其推送到gitlab时:

git push --verbose -u origin master
然后我得到:

Pushing to ssh://git@gitlab.mydomain.com:12035/root/my_project.git
/home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `open'
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in `connect'
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
        from /home/kai/.rvm/rubies/ruby-2.0.0-p247/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.
附笔。 我们已经研究了与错误相关的所有类似问题。但是要么没有得到答案要么他们没有帮助

更新: 上次git推送尝试的
/var/log/auth.log
中的行:

Oct 13 06:53:04 80-69-77-159 sudo:  kai : TTY=pts/2 ; PWD=/home/git/gitlab ; USER=root ; COMMAND=/usr/bin/less /var/log/auth.log
Oct 13 06:53:04 80-69-77-159 sudo: pam_unix(sudo:session): session opened for user root by kai(uid=0)
因此,所有可能的用户都出现在那里。这是什么意思

更新2:

我使用以下工具检查了gitlab shell:

sudo -u git -H /home/git/gitlab-shell/bin/check
得到了同样的结果:

http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
然后我将
config.yml
中的
gitlab\u url更改为
https

sudo -u git -H nano /home/git/gitlab-shell/config.yml

gitlab_url: "http://gitlab.udesk.org/" -> gitlab_url: "https://gitlab.udesk.org/"
现在我从sudo-u git-H/home/git/gitlab shell/bin/check中得到:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Check GitLab API access: OK
Check directories and files: 
    /home/git/repositories: OK
    /home/git/.ssh/authorized_keys: OK
现在有什么问题

更新3: 然后我在
/home/git/gitlab shell/config.yml
中将
自签名证书:false
更改为
自签名证书:true

现在我从sudo-u git-H/home/git/gitlab shell/bin/check中得到:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Check GitLab API access: OK
Check directories and files: 
    /home/git/repositories: OK
    /home/git/.ssh/authorized_keys: OK
但仍然无法推动:

Pushing to ssh://git@gitlab.mydomain.com:12035/root/my_project.git
Access denied.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
更新4: 现在我注意到测试ssh行现在可以工作了:

> ssh -vT -p 12035 git@gitlab.mydomain.com

debug1: Authentication succeeded (publickey).
Authenticated to gitlab.mydomain.com ([x.x.x.x]:12035).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
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
Welcome to GitLab, Administrator!
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3264, received 3248 bytes, in 0.7 seconds
Bytes per second: sent 4782.6, received 4759.2
debug1: Exit status 0
更新5: 在
/home/git/gitlab shell/gitlab shell.log
中,git-push--verbose-u原始主机的对应行是:

W, [2013-10-13T15:18:05.276231 #24654]  WARN -- : gitlab-shell: Access denied for git command <git-receive-pack '/root/myproject.git'> by user with key key-1.
W,[2013-10-13T15:18:05.276231#24654]警告--:gitlab shell:使用key-1的用户拒绝访问git命令。
还有什么问题?

在我执行之后(在使用gitlab的服务器上):

然后删除git remote并再次添加它(在本地服务器上,使用git repo推送到gitlab):

然后试图推动:

> git push --verbose -u origin master

Pushing to ssh://git@gitlab.mydomain.com:12035/root/myproject.git
Counting objects: 401, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (289/289), done.
Writing objects: 100% (401/401), 1.05 MiB | 98.00 KiB/s, done.
Total 401 (delta 127), reused 0 (delta 0)
To ssh://git@gitlab.mydomain.com:12035/root/myproject.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
updating local tracking ref 'refs/remotes/origin/master'  
现在:

>cat/home/git/gitlab-shell/gitlab-shell.log
一、 [2013-10-13T15:38:49.332477#24935]信息--:gitlab shell:使用key-1为用户执行git命令。
一、 [2013-10-13T15:40:00.037092#24958]信息--:将project root/myproject.git中的head更新为。

我不知道这里真正的问题是什么,但尝试一步一步地进行调查是有帮助的(首先修复gitlab_url问题,然后让ssh处理repo,最后让git正常工作)。我希望这些步骤可以帮助解决一些类似的问题(例如,在更新中命名)

默认情况下,unicorn配置为监听
127.0.0.1:8080(/home/git/gitlab/config/unicorn.rb)
,因此
gitlab\u url
需要设置为
http://yourURL:8080/

我意识到这是一篇老文章,但是对于一般的互联网知识库。。在最新版本的gitlab安装程序中出现此错误,apache2中有代理虚拟主机,但也适用于nginx

好吧,我也遇到了同样的问题——下面是我如何解决它的

在/home/git/gitlab/config/unicorn.rb中

找出台词

# listen on both a Unix domain socket and a TCP port,
# we use a shorter backlog for quicker failover when busy
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
listen "127.0.0.1:8080", :tcp_nopush => true
将最后一行更改为

listen "0.0.0.0:8080", :tcp_nopush => true

因此,它不仅接受来自本地机器的连接。

再次强调,希望这可能对某个人、某个地方有用;我也有同样的问题,建议的解决方案都不适合我。具体来说,我不关心HTTPS,我的GitLab也不是Apache背后的代理


我的gitlab shell的配置有
gitlab\u url:http://hostname:9999/
。我的gitlab/config/unicorn.rb有
听“10.80.40.169:9999”
。因此,我刚刚更改了
gitlab\u url
以匹配unicorn.rb(
gitlab\u url:http://10.80.40.169:9999/
)一切正常。

这是一个nginx配置问题吗,如(或)?我想不是。我现在没有“连接被拒绝-连接(2)(Errno::ECONNREFUSED)”,而是
访问被拒绝。
。我不知道现在应该看哪些日志
# listen on both a Unix domain socket and a TCP port,
# we use a shorter backlog for quicker failover when busy
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
listen "127.0.0.1:8080", :tcp_nopush => true
listen "0.0.0.0:8080", :tcp_nopush => true