Gitea Integration
M3 Forge integrates with Gitea for self-hosted Git repository management. This enables version control for workflows, prompts, and configurations.
Gitea is optional. M3 Forge works without Git integration, but connecting a Git provider unlocks repository-based workflow management.
Quick Start
Start Gitea
Create the Docker network and start Gitea:
# Create network (if not exists)
docker network create --driver=bridge marie-network
# Start Gitea
docker compose --env-file .env -f docker/docker-compose.gitea.yml up -dComplete Initial Setup
Navigate to http://localhost:3001 and complete the installation wizard:
- Database Type: SQLite3 (simplest) or PostgreSQL
- Site Title: Marie Studio Git
- Administrator Account: Create your admin user
Create OAuth2 Application
- Log in as admin
- Go to Settings > Applications > Manage OAuth2 Applications
- Click Create a new OAuth2 Application
- Fill in:
- Application Name:
marie-studio - Redirect URIs:
http://localhost:3000/api/auth/gitea/connect/callback
- Application Name:
- Click Create Application
- Save the Client ID and Client Secret (secret is shown only once)
Connect Studio to Gitea
In M3 Forge UI:
- Go to Setup > Git Provider
- Enter:
- Gitea URL:
http://localhost:3001 - Client ID: (from step 3)
- Client Secret: (from step 3)
- Gitea URL:
- Click Connect
Docker Compose Configuration
M3 Forge includes a ready-to-use Gitea compose file at docker/docker-compose.gitea.yml.
Environment Variables
Add these to your .env file:
# Gitea server configuration
GITEA_HTTP_PORT=3001 # Web UI port
GITEA_SSH_PORT=2222 # SSH port
GITEA_DOMAIN=localhost # Server domain
GITEA_ROOT_URL=http://localhost:3001
GITEA_DB_TYPE=sqlite3 # Use 'postgres' for production
GITEA_LOG_LEVEL=info
GITEA_INSTALL_LOCK=false # Set to true after initial setup
GITEA_DISABLE_REGISTRATION=falseCommands
| Command | Description |
|---|---|
docker compose -f docker/docker-compose.gitea.yml up -d | Start Gitea |
docker compose -f docker/docker-compose.gitea.yml down | Stop Gitea |
docker logs -f marie-gitea | View logs |
docker compose -f docker/docker-compose.gitea.yml down --volumes | Reset (removes data) |
Using PostgreSQL
For production deployments, use PostgreSQL instead of SQLite.
Create Gitea Database
# If using Marie-AI PostgreSQL
docker exec marie-psql-server psql -U postgres -c "CREATE DATABASE gitea"
# Or standalone PostgreSQL
docker exec postgres psql -U postgres -c "CREATE DATABASE gitea"Update Environment
GITEA_DB_TYPE=postgres
POSTGRES_HOST=host.docker.internal # or your PostgreSQL host
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your-password
GITEA_DB_NAME=giteaEnable PostgreSQL in Compose
Edit docker/docker-compose.gitea.yml and uncomment the PostgreSQL configuration section.
Automated Setup
Skip the web wizard by using CLI commands.
Create Admin User
docker exec -u git marie-gitea gitea admin user create \
--admin \
--username marie \
--password your-secure-password \
--email marie@marie.local \
--must-change-password=falseAfter creating the admin, set GITEA_INSTALL_LOCK=true in your .env.
Create OAuth2 App via API
curl -s -u "marie:your-password" \
-X POST \
-H "Content-Type: application/json" \
-d '{
"name": "marie-studio",
"redirect_uris": ["http://localhost:3000/api/auth/gitea/connect/callback"],
"confidential_client": true
}' \
"http://localhost:3001/api/v1/user/applications/oauth2"The response contains client_id and client_secret. Save these for Studio configuration.
Using Existing Gitea
If you already have Gitea running elsewhere:
- Create an OAuth2 application in your Gitea instance
- Set the redirect URI to:
http://YOUR_STUDIO_URL/api/auth/gitea/connect/callback - Configure Studio with your Gitea URL and OAuth credentials
The redirect URI must match exactly. For production, replace localhost:3000 with your actual Studio URL.
Network Configuration
Same Docker Network
When running Gitea alongside M3 Forge on the same Docker network:
# Studio accesses Gitea via container name
GITEA_INTERNAL_URL=http://marie-gitea:3000
# Browser accesses Gitea via published port
GITEA_ROOT_URL=http://localhost:3001External Gitea
When Gitea runs on a different host:
# Both Studio and browser use the same URL
GITEA_URL=https://git.example.comTroubleshooting
Gitea won’t start
Check if the port is already in use:
lsof -i :3001View Gitea logs:
docker logs marie-giteaOAuth redirect fails
Verify the redirect URI matches exactly:
- Configured in Gitea:
http://localhost:3000/api/auth/gitea/connect/callback - Studio callback path:
/api/auth/gitea/connect/callback
Database connection errors
If using PostgreSQL, verify:
- Database
giteaexists - PostgreSQL is reachable from the Gitea container
- Credentials are correct
# Test connection from Gitea container
docker exec marie-gitea psql -h host.docker.internal -U postgres -d gitea -c "SELECT 1"Health check fails
Gitea needs time for initial setup and migrations. The default start_period is 120 seconds. Check status:
docker inspect marie-gitea --format='{{.State.Health.Status}}'Reference
Ports
| Port | Service |
|---|---|
| 3001 | Gitea Web UI |
| 2222 | Gitea SSH |
Volumes
| Volume | Purpose |
|---|---|
marie-gitea-data | Repositories, database (SQLite), configuration |
OAuth Callback Path
The correct callback path for M3 Forge is:
/api/auth/gitea/connect/callbackFull URL examples:
- Local development:
http://localhost:3000/api/auth/gitea/connect/callback - Production:
https://studio.example.com/api/auth/gitea/connect/callback