50 lines
1.4 KiB
Markdown
50 lines
1.4 KiB
Markdown
# Local Git Server
|
|
|
|
A self-hosted Git server powered by Gitea with a GitHub-style web interface, repository browsing, issues, pull requests, actions, releases, and SSH/HTTP Git access.
|
|
|
|
## Start it
|
|
|
|
1. Copy `.env.example` to `.env`.
|
|
2. Change `POSTGRES_PASSWORD` in `.env` to a long random value.
|
|
3. Start the stack:
|
|
|
|
```powershell
|
|
docker compose up -d
|
|
```
|
|
|
|
4. Open [http://localhost:3000](http://localhost:3000).
|
|
5. Create the first account. The first account becomes an administrator.
|
|
|
|
The Git SSH endpoint is available on port `2222`:
|
|
|
|
```powershell
|
|
git clone ssh://git@localhost:2222/your-user/your-repository.git
|
|
```
|
|
|
|
HTTPS cloning is also available from the repository page:
|
|
|
|
```powershell
|
|
git clone http://localhost:3000/your-user/your-repository.git
|
|
```
|
|
|
|
## Useful commands
|
|
|
|
```powershell
|
|
# View service logs
|
|
docker compose logs -f gitea
|
|
|
|
# Stop containers but keep repositories and database data
|
|
docker compose down
|
|
|
|
# Stop and permanently delete all Git data
|
|
docker compose down -v
|
|
```
|
|
|
|
## Production notes
|
|
|
|
- Put Gitea behind HTTPS with a reverse proxy before exposing it to the internet.
|
|
- Use a managed or separately backed-up PostgreSQL instance for important repositories.
|
|
- Set `DISABLE_REGISTRATION=true` and `REQUIRE_SIGNIN_VIEW=true` for a private team server.
|
|
- Back up both the `gitea_data` and `postgres_data` volumes.
|
|
- Update `GITEA_ROOT_URL` and `GITEA_DOMAIN` to the public hostname before deploying.
|