推到遠程服務器的git當我開始gitlab有:「拒絕連接 - 連接(2)(錯誤:: ECONNREFUSED)」從gitlab
rvmsudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
當我創建一個新的項目,我得到遠程回購網址:
git remote add origin ssh://[email protected]:12035/root/my_project.git
(so not the default 22 ssh port, but 12035)
所以,當我嘗試將其推到gitlab:
git push --verbose -u origin master
然後我得到:
Pushing to ssh://[email protected]: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.
所以,我有兩個用戶:一個正常:kai
和git
的gitlab。但gitlab
用戶沒有.ssh
目錄。但是我已經從遠程機器添加了ssh-key,我嘗試將它推送到gitlab。鑰匙加入~/.ssh/config
爲:
Host gitlab.mydomain.com
User [email protected]
# User Administrator
IdentityFile ~/.ssh/gitlab_rsa
P.S.
已經研究了與錯誤有關的所有類似問題。但既沒有沒有得到答案,或者他們沒有幫助
更新:
在/var/log/auth.log
行最後git push
嘗試:
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殼有:
sudo -u git -H /home/git/gitlab-shell/bin/check
,並得到了相同的:
http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
我config.yml
再變gitlab_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)
什麼能現在是什麼問題?
更新3:
然後我在/home/git/gitlab-shell/config.yml
改變了self_signed_cert: false
到self_signed_cert: true
。
現在我從sudo -u git -H /home/git/gitlab-shell/bin/check
得到:
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
但仍然不能推:
Pushing to ssh://[email protected]: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 [email protected]
debug1: Authentication succeeded (publickey).
Authenticated to gitlab.mydomain.com ([x.x.x.x]:12035).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
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 [email protected] 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 origin master
是:
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.
可能是什麼仍是問題嗎?
它是一個nginx配置問題,如在https://github.com/gitlabhq/gitlabhq/issues/3384#issuecomment-15457287(或https://github.com/gitlabhq/gitlab-shell/issues/20 #issuecomment-15333049)? – VonC
我認爲不是。我現在沒有'Connection refused - connect(2)(Errno :: ECONNREFUSED)',但是'拒絕訪問.'。我不知道現在應該查看哪些日誌 – static