# Connecting Codemagic to our self-hosted Gitea (SSH) We build the iOS app on Codemagic's macOS cloud (no Mac needed). Codemagic must clone the repo from `code.bizgaze.com`, but that Gitea only exposes **HTTPS (443)** — its **SSH port is not reachable** from the internet, so Codemagic can't connect yet. This is a one-time infra + Codemagic setup. ## Part 1 — IT: expose Gitea's SSH port (git host `118.95.33.93`) 1. **Find Gitea's SSH port.** In `app.ini` → `[server]` → `SSH_PORT` / `SSH_LISTEN_PORT`. Or open a repo in the Gitea web UI → **clone dropdown → SSH** and read the port in the URL, e.g. `ssh://git@code.bizgaze.com:2222/Sravan/BizGaze_Remote.git`. 2. **Port-forward a public TCP port → that Gitea SSH port.** Suggested public port: **2222**. - ⚠️ Nginx Proxy Manager proxies HTTP/HTTPS only. SSH needs a **raw TCP forward** at the firewall/router (or an NPM **Stream** rule) — not an HTTP proxy host. 3. Confirm reachable, then send the DevOps/AI the **SSH clone URL** (with port) to verify. Security: Gitea SSH is **key-only** (no password auth), same model as GitHub's public port 22. Access is further limited to a **read-only deploy key** (below), so a leaked key could only *read* this one repo. ## Part 2 — Codemagic: connect the repo (once the port is open) 1. Codemagic → **Add application → "Other"** (self-hosted / SSH) → paste the SSH clone URL. 2. Copy the **SSH public key** Codemagic shows. 3. Gitea → this repo → **Settings → Deploy Keys → Add Deploy Key** → paste it, **Enable write access = OFF**. 4. Codemagic **Test connection** → it clones and reads [`codemagic.yaml`](../codemagic.yaml). Then follow [IOS_SETUP.md](IOS_SETUP.md) for the App Store Connect key + first build. ## Auto-build on push (optional, later) Manual **Start build** works immediately. Automatic builds on push work natively only for GitHub/GitLab/Bitbucket; for Gitea we'd add a webhook Codemagic can accept — a later nicety, not required.