Update documentation to explain how to securely push code to Gitea
Update the GITEA_TUTO.md file to reflect changes in authentication methods and repository setup, including instructions for storing GITEA_TOKEN as a Replit secret and using a push script for secure uploads. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 923ae0e3-a363-4db8-b04a-e8baca2a1330 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ffa8f38b-d6c8-48cc-9ccf-963475e8344c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8af7d2ec-2cc3-4ece-8af3-9f071488d072/923ae0e3-a363-4db8-b04a-e8baca2a1330/vOeFCU4 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
+66
-87
@@ -2,118 +2,88 @@
|
||||
|
||||
Ce tutoriel explique comment pousser le code de **La Voix du Peuple** depuis Replit vers votre instance Gitea, et comment vous synchroniser ensuite à votre rythme.
|
||||
|
||||
> **État du dépôt** : branche `main`, 10 commits. Remote actif : `gitsafe-backup`.
|
||||
> **État du dépôt** : branche `main`, synchronisée. Remote actif : `origin` (Gitea).
|
||||
|
||||
---
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Une instance Gitea accessible (ex. `https://git.mondomaine.fr`)
|
||||
- Un compte avec les droits de création de dépôt
|
||||
- Git installé localement (si vous travaillez aussi depuis votre poste)
|
||||
- Une instance Gitea accessible (`https://homegit.gyozamancave.fr`)
|
||||
- Un token d'accès Gitea avec droits `repository:write`
|
||||
- Le secret `GITEA_TOKEN` configuré dans Replit (voir Étape 1)
|
||||
|
||||
---
|
||||
|
||||
## Étape 1 — Créer le dépôt sur Gitea
|
||||
## Étape 1 — Stocker le token dans Replit Secrets
|
||||
|
||||
1. Connectez-vous à votre Gitea
|
||||
2. Cliquez sur **+ New Repository**
|
||||
3. Nom suggéré : `voix-du-peuple`
|
||||
4. Laissez-le **vide** (pas de README, pas de .gitignore)
|
||||
5. Notez l'URL du dépôt — elle ressemble à :
|
||||
- SSH : `git@git.mondomaine.fr:vous/voix-du-peuple.git`
|
||||
- HTTPS : `https://git.mondomaine.fr/vous/voix-du-peuple.git`
|
||||
Votre token Gitea doit être stocké comme secret Replit, jamais dans un fichier versionné.
|
||||
|
||||
1. Dans Replit → **Secrets** (cadenas dans le panneau latéral)
|
||||
2. Ajouter un secret :
|
||||
- **Clé** : `GITEA_TOKEN`
|
||||
- **Valeur** : votre token Gitea
|
||||
|
||||
Pour générer ou renouveler un token sur Gitea :
|
||||
**Paramètres du compte → Applications → Générer un token**
|
||||
Permissions requises : `repository` (lecture + écriture)
|
||||
|
||||
---
|
||||
|
||||
## Étape 2 — Ajouter Gitea comme remote depuis Replit
|
||||
## Étape 2 — Pousser vers Gitea
|
||||
|
||||
Dans le shell Replit (onglet **Shell**) :
|
||||
Le script `scripts/push-gitea.sh` gère l'authentification automatiquement.
|
||||
|
||||
Dans le shell Replit :
|
||||
|
||||
```bash
|
||||
# Vérifier les remotes actuels
|
||||
git remote -v
|
||||
bash scripts/push-gitea.sh
|
||||
```
|
||||
|
||||
# Ajouter votre Gitea comme remote (choisissez SSH ou HTTPS)
|
||||
git remote add gitea git@git.mondomaine.fr:vous/voix-du-peuple.git
|
||||
# ou en HTTPS :
|
||||
git remote add gitea https://git.mondomaine.fr/vous/voix-du-peuple.git
|
||||
Ce script :
|
||||
- Lit `GITEA_TOKEN` depuis l'environnement
|
||||
- Encode les identifiants en Base64 (compatibilité Git 2.50+)
|
||||
- Pousse la branche `main` vers `origin` (Gitea)
|
||||
|
||||
# Vérifier
|
||||
git remote -v
|
||||
---
|
||||
|
||||
## Pourquoi ce script ? (contexte technique)
|
||||
|
||||
Git 2.50+ ignore les tokens embarqués dans les URLs (`https://user:token@host/...`) pour des raisons de sécurité. La solution est de passer l'en-tête `Authorization: Basic` explicitement via `-c http.extraHeader`.
|
||||
|
||||
```bash
|
||||
# Ce que fait le script, en détail :
|
||||
B64=$(printf '%s' "billisdead:${GITEA_TOKEN}" | base64 -w0)
|
||||
git -c "http.extraHeader=Authorization: Basic ${B64}" push origin main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Étape 3 — Configurer l'authentification
|
||||
## Étape 3 — Récupérer les mises à jour depuis Replit
|
||||
|
||||
### Option A — SSH (recommandé)
|
||||
|
||||
Générez une clé SSH dans le shell Replit si vous n'en avez pas :
|
||||
Chaque fois que vous voulez synchroniser votre Gitea avec l'état actuel du projet :
|
||||
|
||||
```bash
|
||||
ssh-keygen -t ed25519 -C "replit-voix-du-peuple"
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
bash scripts/push-gitea.sh
|
||||
```
|
||||
|
||||
Copiez la clé publique affichée et ajoutez-la dans Gitea :
|
||||
**Paramètres → Clés SSH → Ajouter une clé**
|
||||
|
||||
Testez la connexion :
|
||||
Si vous avez modifié des fichiers directement sur Gitea (peu recommandé) :
|
||||
|
||||
```bash
|
||||
ssh -T git@git.mondomaine.fr
|
||||
```
|
||||
|
||||
### Option B — HTTPS avec token
|
||||
|
||||
Dans Gitea : **Paramètres → Applications → Générer un token**
|
||||
|
||||
Utilisez l'URL avec token :
|
||||
|
||||
```bash
|
||||
git remote set-url gitea https://VOTRE_TOKEN@git.mondomaine.fr/vous/voix-du-peuple.git
|
||||
# Récupérer les changements Gitea d'abord
|
||||
B64=$(printf '%s' "billisdead:${GITEA_TOKEN}" | base64 -w0)
|
||||
git -c "http.extraHeader=Authorization: Basic ${B64}" pull origin main --rebase
|
||||
bash scripts/push-gitea.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Étape 4 — Pousser le code
|
||||
8
|
||||
```bash
|
||||
# Premier push (établit le tracking)
|
||||
git push -u gitea main
|
||||
|
||||
# Pour les push suivants
|
||||
git push gitea main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Étape 5 — Récupérer les mises à jour depuis Replit
|
||||
|
||||
Chaque fois que vous voulez synchroniser votre Gitea avec l'état actuel du projet Replit :
|
||||
|
||||
```bash
|
||||
# Depuis le shell Replit
|
||||
git push gitea main
|
||||
```
|
||||
|
||||
Si vous avez également modifié des fichiers directement sur Gitea :
|
||||
|
||||
```bash
|
||||
git pull gitea main --rebase
|
||||
git push gitea main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Étape 6 — Cloner depuis Gitea sur votre serveur de production
|
||||
## Étape 4 — Cloner depuis Gitea sur votre serveur de production
|
||||
|
||||
Sur votre serveur RockyLinux / Debian :
|
||||
|
||||
```bash
|
||||
git clone git@git.mondomaine.fr:vous/voix-du-peuple.git
|
||||
cd voix-du-peuple
|
||||
git clone https://homegit.gyozamancave.fr/billisdead/la-voix-du-peuple.git
|
||||
cd la-voix-du-peuple
|
||||
|
||||
# Copier et adapter les variables d'environnement
|
||||
cp .env.example .env
|
||||
@@ -134,16 +104,13 @@ pnpm --filter @workspace/voix-du-peuple run build --config vite.config.selfhost.
|
||||
## Résumé des commandes utiles
|
||||
|
||||
```bash
|
||||
# Pousser vers Gitea (commande principale)
|
||||
bash scripts/push-gitea.sh
|
||||
|
||||
# Voir l'état du dépôt
|
||||
git status
|
||||
git log --oneline -10
|
||||
|
||||
# Synchroniser vers Gitea
|
||||
git push gitea main
|
||||
|
||||
# Récupérer depuis Gitea
|
||||
git pull gitea main
|
||||
|
||||
# Voir les remotes configurés
|
||||
git remote -v
|
||||
```
|
||||
@@ -157,10 +124,16 @@ git remote -v
|
||||
| `main` | Code de production, stable — **seule branche à pousser vers Gitea** |
|
||||
| `replit-agent` | Branche de travail interne de l'agent Replit — ne pas pousser |
|
||||
|
||||
```bash
|
||||
# Pousser uniquement main
|
||||
git push gitea main
|
||||
```
|
||||
---
|
||||
|
||||
## Remotes configurés
|
||||
|
||||
| Nom | URL | Usage |
|
||||
|-----|-----|-------|
|
||||
| `origin` | `https://homegit.gyozamancave.fr/billisdead/la-voix-du-peuple.git` | Gitea principal |
|
||||
| `gitsafe-backup` | `git://gitsafe:5418/backup.git` | Sauvegarde interne Replit |
|
||||
|
||||
> **Important** : ne jamais inclure de token dans une URL de remote. Le token doit rester dans `GITEA_TOKEN` (Replit Secrets) et être transmis via le script.
|
||||
|
||||
---
|
||||
|
||||
@@ -180,8 +153,14 @@ artifacts/
|
||||
about.tsx ← À propos
|
||||
transparence.tsx ← Fonctionnement & données
|
||||
flyer.tsx ← Flyer QR code imprimable
|
||||
components/
|
||||
accessibility-panel.tsx ← Panneau d'accessibilité
|
||||
hooks/
|
||||
use-accessibility.tsx ← Contexte et persistance
|
||||
App.tsx ← Routing et navbar
|
||||
index.css ← Styles globaux + @media print
|
||||
index.css ← Styles globaux, dark mode, accessibilité
|
||||
scripts/
|
||||
push-gitea.sh ← Script de push sécurisé vers Gitea
|
||||
deploy/
|
||||
nginx.conf ← Config Nginx production
|
||||
voix-du-peuple-api.service ← Unité systemd Gunicorn
|
||||
|
||||
Reference in New Issue
Block a user