我有一个gitlab ce映像通过docker compose 运行
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
但我遇到了一个错误:git@gitlab.theboohers.org: 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
在那之后,我能够克隆具有如下URL的存储库:
git clone ssh://git@${GITLAB_HOST}:${SSH_PORT}/${REPOSITORY}.git
请注意,端口22已经被使用,我必须设置另一个端口。