This commit is contained in:
Kulvir Singh
2025-11-03 02:05:22 +05:30
parent 89a0026db8
commit 6694fabb14
2 changed files with 65 additions and 70 deletions

View File

@@ -37,15 +37,13 @@ Copy the content of [docker-compose.yaml](./docker-compose.yaml) file to newly c
### 2. Reverse Proxy Setup
To make it Gitea accessible outside the server we need to setup a subdomain for Gitea `https://git.domain.com` and set up a reverse proxy with Caddy.
To make Gitea accessible outside the server, we need to set up a subdomain for Gitea at `https://git.domain.com` and set up a reverse proxy with Caddy.
Set Up DNS by creating an **A Record**
Create an **A Record** in your domain's DNS settings
* **Name**: `git` (for `git.domain.com`)
* **Value**: Server's IP address
Create a reverse proxy for `git.domain.com` domain
Create the config file in Caddy's config directory:
Create a reverse proxy for the `git.domain.com` domain in Caddy's config directory:
```bash
sudo vim /etc/caddy/conf.d/gitea.Caddyfile
@@ -61,7 +59,7 @@ sudo systemctl reload caddy
Change the `GITEA__server__ROOT_URL` environment variable inside the docker-compose file to the git subdomain.
Start the GITEA docker container
Start the Gitea Docker Container
```bash
docker compose up -d
@@ -73,23 +71,25 @@ Gitea is now running on port 3000 and will show an installation wizard.
## Installation Setup
**Database** SQLite just to keep it simple
Fill out the the details in installation wizard
**Site Title:** a cool name or just use default "Gitea"
**Database:** SQLite (just to keep it simple)
**Repository Root Path** keep the default`/data/git/repositories`
**Site Title:** A cool name or just use the default "Gitea"
**Server Domain** Gitea domain `git.domain.com`
**Repository Root Path:** Keep the default `/data/git/repositories`
**Server Domain:** Gitea domain `git.domain.com`
**SSH Port:** `2222`
**HTTP Port:** keep default`3000` or just use any available port
**HTTP Port:** Keep the default `3000` or just use any available port
**Gitea Base Url:** `https://git.domain.com`
**Gitea Base URL:** `https://git.domain.com`
**Server Settings:** Enable `Local Mode` and disable `Self Registeration` if installing for personal use.
**Server Settings:** Enable `Local Mode` and disable `Self Registration` if installing for personal use.
After this just click on **Install Gitea** button and your Gitea is ready to use
After this, just click on the **Install Gitea** button and your Gitea is ready to use!
---
@@ -159,10 +159,9 @@ environment:
- USER_GID=101
```
### 3. Generate SSH Keys on host
### 3. Generate SSH Keys on Host
The `git` user on your server needs to connect to the Gitea container to perform git operations.
Generate an SSH key that allows this connection.
The `git` user on your server needs to connect to the Gitea container to perform git operations. Generate an SSH key that allows this connection.
```bash
sudo -u git ssh-keygen -t ed25519 -f /home/git/.ssh/gitea_key -N ""
@@ -172,9 +171,7 @@ This creates two files:
* `/home/git/.ssh/gitea_key` - Private key (keep this secret!)
* `/home/git/.ssh/gitea_key.pub` - Public key
Also add the public key to authorized_keys.
This allows the git user to SSH into the container.
Also add the public key to `authorized_keys`. This allows the git user to SSH into the container.
```bash
sudo -u git cat /home/git/.ssh/gitea_key.pub | sudo -u git tee -a /home/git/.ssh/authorized_keys
@@ -195,14 +192,15 @@ EOF
sudo chmod +x /usr/local/bin/gitea
```
After all the changes restart the gitea container
After all the changes, restart the Gitea container
```bash
docker compose restart
```
### 5. Test SSH Access
Now users can add their SSH public keys to their Gitea accounts and use Git over SSH it should work perfectly fine.
Now users can add their SSH public keys to their Gitea accounts and use Git over SSH. It should work perfectly fine!
Try cloning a repository