Ssh

GitLab 沒有監聽 ssh 埠

  • September 10, 2021

我剛剛通過omnibus在執行Ubuntu 14.0.4 LTS的VPS上安裝了GitLab CE,對以下內容進行了更改/etc/gitlab/gitlab.rb並重新執行sudo gitlab-ctl reconfigure

gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
external_url 'https://gitlab.myserver.com/'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
web_server['external_users'] = ['www-data']
nginx['enable'] = false

我的 Apache VirtualHost 配置正在執行,我可以訪問 Web 界面https://gitlab.myserver.com/,我已在其中添加了我的 SSH 密鑰,但是當ssh://git@gitlab.myserver.com:2222/mygroup/myproject.git我收到

ssh: connect to host gitlab.myserver.com port 2222: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

$ ssh -vvv -T -p 2222 gitlab.myserver.com:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/me/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to gitlab.myserver.com [12.34.56.78] port 2222.
debug1: connect to address 12.34.56.78 port 2222: Connection refused
ssh: connect to host gitlab.myserver.com port 2222: Connection refused

$ netstat -tlpn未列出偵聽埠 2222 的任何程序

$ sudo gitlab-rake gitlab:check不會產生任何錯誤或警告 ( http://pastebin.com/ThCJ0nU7 )

ufw 允許使用埠 2222/tcp

您需要根據伺服器執行gitlab_rails['gitlab_shell_ssh_port'] = 2222的埠設置選項。sshd

如果我是對的,Gitlab 沒有執行單獨的 ssh 伺服器。如果您sshd在標準埠上執行,只需切換到22,重新啟動gitlabsshd在標準埠上重試。

如果您堅持在不同的埠上執行,您還需要修改您的sshd_config以及可能在您的 VPS 上的其他內容。

引用自:https://serverfault.com/questions/743443