218 lines
3.5 KiB
Markdown
218 lines
3.5 KiB
Markdown
# Guide Gitea pour Claude
|
|
|
|
## Credentials
|
|
|
|
**Toujours lire en premier:**
|
|
```
|
|
C:\Users\alexi\Documents\projects\ProjectTracker\.env
|
|
```
|
|
|
|
Contient:
|
|
- `GITEA_URL` - URL du serveur Gitea
|
|
- `GITEA_TOKEN` - Token d'authentification API
|
|
|
|
## Creer un nouveau repo
|
|
|
|
### 1. Creer le repo sur Gitea via API
|
|
|
|
```bash
|
|
curl -X POST "https://git.etheryale.com/api/v1/user/repos" \
|
|
-H "Authorization: token <GITEA_TOKEN>" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"name\": \"<nom-repo>\", \"description\": \"<description>\", \"private\": false}"
|
|
```
|
|
|
|
**Reponse:** JSON avec `clone_url` et `html_url`
|
|
|
|
### 2. Initialiser git localement
|
|
|
|
```bash
|
|
cd "<chemin-projet>"
|
|
git init
|
|
```
|
|
|
|
### 3. Creer .gitignore adapte au projet
|
|
|
|
Exemple pour projet Access/VBA:
|
|
```
|
|
# Access lock files
|
|
*.laccdb
|
|
*.ldb
|
|
|
|
# Backups
|
|
.vba_backups/
|
|
*.bak
|
|
|
|
# Windows
|
|
Thumbs.db
|
|
Desktop.ini
|
|
nul
|
|
con
|
|
prn
|
|
aux
|
|
|
|
# Temp
|
|
*.tmp
|
|
~$*
|
|
```
|
|
|
|
### 4. Ajouter les fichiers
|
|
|
|
**Important:** Ne pas utiliser `git add .` si fichier `nul` existe (erreur Windows).
|
|
|
|
Ajouter fichiers specifiquement:
|
|
```bash
|
|
git add .gitignore README.md <autres-fichiers>
|
|
git add <dossiers>/
|
|
git status
|
|
```
|
|
|
|
### 5. Premier commit
|
|
|
|
```bash
|
|
git commit -m "$(cat <<'EOF'
|
|
Initial commit - <Nom Projet>
|
|
|
|
<Description des fichiers>
|
|
|
|
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
|
|
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
EOF
|
|
)"
|
|
```
|
|
|
|
### 6. Configurer remote et push
|
|
|
|
```bash
|
|
git branch -M main
|
|
git remote add origin https://git.etheryale.com/StillHammer/<nom-repo>.git
|
|
git push -u origin main
|
|
```
|
|
|
|
---
|
|
|
|
## Operations courantes
|
|
|
|
### Commit et push
|
|
|
|
```bash
|
|
git add <fichiers>
|
|
git commit -m "Description du changement"
|
|
git push
|
|
```
|
|
|
|
### Voir le status
|
|
|
|
```bash
|
|
git status
|
|
git log --oneline -5
|
|
```
|
|
|
|
### Creer une branche
|
|
|
|
```bash
|
|
git checkout -b feature/ma-fonctionnalite
|
|
git push -u origin feature/ma-fonctionnalite
|
|
```
|
|
|
|
---
|
|
|
|
## API Gitea - Endpoints utiles
|
|
|
|
Base URL: `https://git.etheryale.com/api/v1`
|
|
|
|
| Action | Methode | Endpoint |
|
|
|--------|---------|----------|
|
|
| Lister mes repos | GET | `/user/repos` |
|
|
| Creer repo | POST | `/user/repos` |
|
|
| Info repo | GET | `/repos/StillHammer/<repo>` |
|
|
| Supprimer repo | DELETE | `/repos/StillHammer/<repo>` |
|
|
| Lister branches | GET | `/repos/StillHammer/<repo>/branches` |
|
|
| Lister issues | GET | `/repos/StillHammer/<repo>/issues` |
|
|
| Creer issue | POST | `/repos/StillHammer/<repo>/issues` |
|
|
|
|
### Exemple: Lister mes repos
|
|
|
|
```bash
|
|
curl -H "Authorization: token <GITEA_TOKEN>" \
|
|
"https://git.etheryale.com/api/v1/user/repos" | jq '.[].name'
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Erreur "nul" ou fichier reserve Windows
|
|
|
|
Ajouter au .gitignore:
|
|
```
|
|
nul
|
|
con
|
|
prn
|
|
aux
|
|
```
|
|
|
|
Et ajouter fichiers specifiquement au lieu de `git add .`
|
|
|
|
### Erreur proxy/connexion
|
|
|
|
Le fichier .env mentionne:
|
|
> Use wget instead of curl for API calls due to proxy compatibility
|
|
|
|
Si curl echoue, essayer wget:
|
|
```bash
|
|
wget --header="Authorization: token <TOKEN>" \
|
|
--header="Content-Type: application/json" \
|
|
--post-data='{"name":"repo"}' \
|
|
-qO- "https://git.etheryale.com/api/v1/user/repos"
|
|
```
|
|
|
|
### Authentification git push
|
|
|
|
Si demande credentials, utiliser:
|
|
- Username: `StillHammer`
|
|
- Password: `<GITEA_TOKEN>`
|
|
|
|
Ou configurer credential helper:
|
|
```bash
|
|
git config credential.helper store
|
|
```
|
|
|
|
---
|
|
|
|
## Template .gitignore par type de projet
|
|
|
|
### Python
|
|
```
|
|
__pycache__/
|
|
*.pyc
|
|
*.pyo
|
|
.venv/
|
|
venv/
|
|
*.egg-info/
|
|
dist/
|
|
build/
|
|
```
|
|
|
|
### Node.js
|
|
```
|
|
node_modules/
|
|
npm-debug.log
|
|
.env
|
|
dist/
|
|
```
|
|
|
|
### Access/VBA
|
|
```
|
|
*.laccdb
|
|
*.ldb
|
|
.vba_backups/
|
|
~$*
|
|
```
|
|
|
|
---
|
|
|
|
**Auteur:** Claude
|
|
**Date:** 2025-12-30
|