251 lines
4.9 KiB
Markdown
251 lines
4.9 KiB
Markdown
# Gitea Configuration
|
|
|
|
## Server Details
|
|
- **URL**: http://192.168.1.142:3000
|
|
- **Organization**: Fristy-app
|
|
- **Token**: Gespeichert in `.env` (nicht in Git!)
|
|
|
|
## Repository Setup
|
|
|
|
### Initial Push to Gitea
|
|
|
|
```bash
|
|
# 1. Remote hinzufügen
|
|
git remote add origin http://192.168.1.142:3000/Fristy-app/fristy.git
|
|
|
|
# 2. Initial Commit (falls noch nicht gemacht)
|
|
git add .
|
|
git commit -m "chore: initial project setup"
|
|
|
|
# 3. Push zu Gitea
|
|
git push -u origin main
|
|
|
|
# 4. Develop Branch erstellen
|
|
git checkout -b develop
|
|
git push -u origin develop
|
|
```
|
|
|
|
### Authentifizierung
|
|
|
|
**Option 1: HTTPS mit Token**
|
|
```bash
|
|
# Token als Passwort verwenden
|
|
git remote set-url origin http://<username>:<token>@192.168.1.142:3000/Fristy-app/fristy.git
|
|
```
|
|
|
|
**Option 2: Git Credential Helper**
|
|
```bash
|
|
# Token speichern
|
|
git config credential.helper store
|
|
# Beim nächsten Push Token eingeben
|
|
```
|
|
|
|
**Option 3: SSH (empfohlen für lokales Netzwerk)**
|
|
```bash
|
|
# SSH-Key generieren
|
|
ssh-keygen -t ed25519 -C "your-email@example.com"
|
|
|
|
# Public Key zu Gitea hinzufügen
|
|
# Unter: http://192.168.1.142:3000/user/settings/keys
|
|
|
|
# Remote auf SSH umstellen
|
|
git remote set-url origin git@192.168.1.142:Fristy-app/fristy.git
|
|
```
|
|
|
|
## Gitea-spezifische Features
|
|
|
|
### Branch Protection
|
|
|
|
1. Gehe zu Repository Settings
|
|
2. Branches → Protected Branches
|
|
3. Schütze `main` und `develop`:
|
|
- ✅ Require pull request reviews before merging
|
|
- ✅ Require status checks to pass
|
|
- ✅ Include administrators
|
|
|
|
### Webhooks (für CI/CD)
|
|
|
|
1. Settings → Webhooks
|
|
2. Add Webhook → Gitea
|
|
3. Payload URL: `http://your-ci-server/webhook`
|
|
4. Events:
|
|
- ✅ Push
|
|
- ✅ Pull Request
|
|
- ✅ Release
|
|
|
|
### Repository Visibility
|
|
|
|
- **Private**: Nur für Team sichtbar
|
|
- **Public**: Öffentlich zugänglich
|
|
|
|
## CI/CD mit Gitea Actions
|
|
|
|
Gitea unterstützt GitHub Actions-kompatible Workflows!
|
|
|
|
### `.gitea/workflows/ci.yml`
|
|
|
|
```yaml
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
- run: npm ci
|
|
- run: npm run lint
|
|
- run: npm run type-check
|
|
- run: npm test
|
|
```
|
|
|
|
## Team-Zugriff
|
|
|
|
### Collaborators hinzufügen
|
|
|
|
1. Repository → Settings → Collaborators
|
|
2. Add Collaborator
|
|
3. Rechte festlegen:
|
|
- **Read**: Nur lesen
|
|
- **Write**: Lesen + Schreiben
|
|
- **Admin**: Volle Rechte
|
|
|
|
## Nützliche Gitea-Befehle
|
|
|
|
```bash
|
|
# Status prüfen
|
|
git remote -v
|
|
|
|
# Änderungen pushen
|
|
git push origin feature/mein-feature
|
|
|
|
# Pull Request via CLI (gh-cli oder tea)
|
|
tea pr create --title "Mein Feature" --body "Beschreibung"
|
|
|
|
# Releases erstellen
|
|
git tag -a v0.1.0 -m "Release v0.1.0"
|
|
git push origin v0.1.0
|
|
```
|
|
|
|
## Gitea CLI Tool (tea)
|
|
|
|
```bash
|
|
# Installation
|
|
brew install tea # macOS
|
|
# oder: https://gitea.com/gitea/tea
|
|
|
|
# Login
|
|
tea login add
|
|
|
|
# Repository clonen
|
|
```bash
|
|
# Repository clonen
|
|
tea clone Fristy-app/fristy
|
|
|
|
# Issues erstellen
|
|
tea issues create
|
|
|
|
# Pull Requests
|
|
tea pr list
|
|
tea pr create
|
|
```
|
|
|
|
## Backup-Strategie
|
|
|
|
### Lokales Backup
|
|
|
|
```bash
|
|
# Kompletter Clone mit allen Branches
|
|
git clone --mirror http://192.168.1.142:3000/Firstly/fristy.git
|
|
```
|
|
|
|
### Automatisches Backup
|
|
|
|
```bash
|
|
# Cron-Job für tägliches Backup
|
|
0 2 * * * git -C /path/to/backup/fristy.git fetch --all
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### SSL-Zertifikat-Fehler
|
|
|
|
```bash
|
|
# Für lokales Netzwerk (nur Development!)
|
|
git config --global http.sslVerify false
|
|
```
|
|
|
|
### Token-Authentifizierung
|
|
|
|
```bash
|
|
# Token in URL
|
|
git clone http://token@192.168.1.142:3000/Fristy-app/fristy.git
|
|
|
|
# Oder in .netrc speichern
|
|
# ~/.netrc
|
|
machine 192.168.1.142
|
|
login username
|
|
password ec01d92db7f02dec1089cbb00076d9cbd533fd3f
|
|
```
|
|
|
|
### Push wird abgelehnt
|
|
|
|
```bash
|
|
# Force Push vermeiden!
|
|
# Stattdessen:
|
|
git pull --rebase origin main
|
|
git push origin main
|
|
```
|
|
|
|
## Best Practices
|
|
|
|
✅ **DO**
|
|
- Token in `.env` speichern (nicht in Git!)
|
|
- Branch Protection für main/develop
|
|
- Pull Requests für alle Features
|
|
- Issues für Bug-Tracking
|
|
- Releases mit Tags
|
|
|
|
❌ **DON'T**
|
|
- Token in Code commiten
|
|
- Direkt auf main pushen
|
|
- Force Push auf shared branches
|
|
- Große Binärdateien committen
|
|
|
|
## Repository-Links
|
|
|
|
- **Repository**: http://192.168.1.142:3000/Fristy-app/fristy
|
|
- **Issues**: http://192.168.1.142:3000/Fristy-app/fristy/issues
|
|
- **Pull Requests**: http://192.168.1.142:3000/Fristy-app/fristy/pulls
|
|
- **Releases**: http://192.168.1.142:3000/Fristy-app/fristy/releases
|
|
- **Settings**: http://192.168.1.142:3000/Fristy-app/fristy/settings
|
|
|
|
## Quick Commands
|
|
|
|
```bash
|
|
# Repository initialisieren und pushen
|
|
git init
|
|
git add .
|
|
git commit -m "chore: initial project setup"
|
|
git remote add origin http://192.168.1.142:3000/Fristy-app/fristy.git
|
|
git push -u origin main
|
|
|
|
# Develop Branch
|
|
git checkout -b develop
|
|
git push -u origin develop
|
|
|
|
# Feature entwickeln
|
|
git checkout -b feature/auth-screens
|
|
# ... entwickeln ...
|
|
git push origin feature/auth-screens
|
|
# Dann: Pull Request in Gitea erstellen
|
|
```
|