4.9 KiB
4.9 KiB
Gitea Configuration
Server Details
- URL: http://192.168.1.142:3000
- Organization/User: Firstly
- Token: Gespeichert in
.env(nicht in Git!)
Repository Setup
Initial Push to Gitea
# 1. Remote hinzufügen
git remote add origin http://192.168.1.142:3000/Firstly/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
# Token als Passwort verwenden
git remote set-url origin http://<username>:<token>@192.168.1.142:3000/Firstly/fristy.git
Option 2: Git Credential Helper
# Token speichern
git config credential.helper store
# Beim nächsten Push Token eingeben
Option 3: SSH (empfohlen für lokales Netzwerk)
# 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:Firstly/fristy.git
Gitea-spezifische Features
Branch Protection
- Gehe zu Repository Settings
- Branches → Protected Branches
- Schütze
mainunddevelop:- ✅ Require pull request reviews before merging
- ✅ Require status checks to pass
- ✅ Include administrators
Webhooks (für CI/CD)
- Settings → Webhooks
- Add Webhook → Gitea
- Payload URL:
http://your-ci-server/webhook - 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
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
- Repository → Settings → Collaborators
- Add Collaborator
- Rechte festlegen:
- Read: Nur lesen
- Write: Lesen + Schreiben
- Admin: Volle Rechte
Nützliche Gitea-Befehle
# 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)
# Installation
brew install tea # macOS
# oder: https://gitea.com/gitea/tea
# Login
tea login add
# Repository clonen
tea clone Firstly/fristy
# Issues erstellen
tea issues create
# Pull Requests
tea pr list
tea pr create
Backup-Strategie
Lokales Backup
# Kompletter Clone mit allen Branches
git clone --mirror http://192.168.1.142:3000/Firstly/fristy.git
Automatisches Backup
# Cron-Job für tägliches Backup
0 2 * * * git -C /path/to/backup/fristy.git fetch --all
Troubleshooting
SSL-Zertifikat-Fehler
# Für lokales Netzwerk (nur Development!)
git config --global http.sslVerify false
Token-Authentifizierung
# Token in URL
git clone http://token@192.168.1.142:3000/Firstly/fristy.git
# Oder in .netrc speichern
# ~/.netrc
machine 192.168.1.142
login username
password ec01d92db7f02dec1089cbb00076d9cbd533fd3f
Push wird abgelehnt
# Force Push vermeiden!
# Stattdessen:
git pull --rebase origin main
git push origin main
Best Practices
✅ DO
- Token in
.envspeichern (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/Firstly/fristy
- Issues: http://192.168.1.142:3000/Firstly/fristy/issues
- Pull Requests: http://192.168.1.142:3000/Firstly/fristy/pulls
- Releases: http://192.168.1.142:3000/Firstly/fristy/releases
- Settings: http://192.168.1.142:3000/Firstly/fristy/settings
Quick Commands
# 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/Firstly/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