我已经使用 docker-compose 设置了 gitea,我机器的外部 SSH 端口是 4444,我在 sshd_config 中设置
version: '2'
volumes:
gitea:
postgres:
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
env_file:
- .env
restart: always
networks:
- gitea
volumes:
- gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
depends_on:
- postgres
postgres:
image: postgres:9.6
restart: always
env_file:
- gittea_db.env
networks:
- gitea
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql/data
以下是 .env 文件
USER_UID=1002
USER_GID=1001
DB_TYPE=postgres
DB_HOST=postgres:5432
DB_NAME=gittea
DB_USER=gittea
DB_PASSWD=password12
INSTALL_LOCK=True
APP_NAME=myapp
RUN_MODE=prod
DOMAIN=source.smarticlelabs.com
ROOT_URL=https://source.smarticlelabs.com
SSH_LISTEN_PORT=22
SSH_PORT=2222
但是当我在添加我的 ssh 密钥后尝试克隆一个 repo 时,我收到了这个错误
git clone ssh://[email protected]:2222/superadmin/testrepo.git
Cloning into 'testrepo'...
ssh: connect to host 51.15.245.237 port 2222: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.