configure SSH_PORT via env var to fix clone URL display

This commit is contained in:
2026-04-23 19:06:08 +08:00
parent 58f31e698d
commit a43815d4a0
3 changed files with 8 additions and 1 deletions

View File

@@ -8,6 +8,9 @@ SSH_PORT=2222
# 时区
TZ=Asia/Shanghai
# SSH 端口配置(告知 Gitea 对外 SSH 端口,用于 clone 地址显示)
GITEA__server__SSH_PORT=${SSH_PORT}
# Git LFS 配置
GITEA__lfs__START_SERVER=true
GITEA__lfs__PATH=/data/git/lfs

View File

@@ -16,9 +16,12 @@ cp .env.example .env
```env
HTTP_PORT=3000 # Web 界面端口
SSH_PORT=2222 # SSH 端口
SSH_PORT=2222 # SSH 端口(宿主机端口,容器内仍为 22
```
> `GITEA__server__SSH_PORT` 已通过 `.env` 传递给容器,告知 Gitea 对外 SSH 端口为 `2222`
> 使 Web 界面中的 SSH clone 地址正确显示端口号。
### 2. 启动服务
```bash

View File

@@ -7,6 +7,7 @@ services:
- GITEA__lfs__START_SERVER=${GITEA__lfs__START_SERVER}
- GITEA__lfs__PATH=${GITEA__lfs__PATH}
- GITEA__service__DISABLE_REGISTRATION=${GITEA__service__DISABLE_REGISTRATION}
- GITEA__server__SSH_PORT=${GITEA__server__SSH_PORT}
restart: always
volumes:
- ./data:/data