我有一个通过 docker-compose 运行的 gitlab ce 图像
gitlab:
image: 'gitlab/gitlab-ce:latest'
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.theboohers.org'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '8000:80'
- '8001:443'
- '22:22'
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
networks:
- app-network
我可以通过 https 登录(使用 nginx 代理),但我无法通过 ssh 进行身份验证。
我验证了端口 22 正在侦听:
nc -vz gitlab.theboohers.org 22
Connection to gitlab.theboohers.org (194.195.222.5) 22 port [tcp/ssh] succeeded!
在详细输出中,我看到正在提供密钥: debug1: Offering public key: /home/deploy/.ssh/id_rsa RSA SHA256
但我遇到了错误: [email protected]: Permission denied (publickey).
完整详细的 ssh 连接:https : //gist.github.com/tbbooher/336e1bb277456efde6003111a56f3118
为了能够与 ssh 连接,我必须在 GITLAB_OMNIBUS_CONFIG 环境变量中添加以下几行:
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://${GITLAB_HOST}'
# ...
gitlab_rails['gitlab_shell_ssh_port'] = ${SSH_PORT}
并打开端口(如您所愿):
ports:
- ${SSH_PORT}:22
之后,我能够使用如下网址克隆存储库:
git clone ssh://git@${GITLAB_HOST}:${SSH_PORT}/${REPOSITORY}.git
请注意,端口 22 已被使用,我不得不设置另一个。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句