Sans Fork
git push origin main → 403 Forbidden → bloqué
Dans l’open source ou une grande équipe, vous n’avez pas le droit d’écrire sur upstream (le dépôt officiel).
Sans Fork
git push origin main → 403 Forbidden → bloqué
Avec Fork
Fork (votre copie) → clone → PR → review → upstream décide
upstream → crée votre-username/projet
(origin) 2. Cloner votre fork : bash git clone https://github.com/votre-username/projet.git cd projet 3. Ajouter l’upstream : bash git remote add upstream https://github.com/upstream/projet.git git remote -v # origin https://github.com/votre-username/projet.git (fork) # upstream https://github.com/upstream/projet.git (original) 4. Travailler sur une branche : bash git switch -c feat/ma-contrib git commit -m "feat: add feature" 5. Synchroniser
régulièrement : bash git fetch upstream git switch main git merge upstream/main # ou gh repo sync 6. Pousser & PR : bash git push -u origin feat/ma-contrib gh pr create --fill # Voir les commits en retardgit log --oneline HEAD..upstream/maingit fetch upstreamgit merge upstream/maingit push origin main # met à jour votre forkVariante gh :
gh repo fork upstream/projet --clone --remotegh repo syncCommandes à exécuter
gh) — le terminal qui remplace le navigateurgh = GitHub dans le terminal. Auth, repo, issue, pr, release, codespace.
gh auth login# GitHub.com → HTTPS → Yes → Paste tokengh auth statusgh repo clone joinhashcode/workshopsgh repo view --webgh repo fork upstream/projet --clonegh repo create mon-projet --public --license mit --clonegh repo syncgh issue list --limit 10gh issue create --title "bug: login" --body "Closes #42"gh issue view 42 --web
gh pr create --draft --fillgh pr create --title "feat: add login" --body "Closes #42" --reviewer joinhashcode/teamgh pr view 42 --webgh pr checkout 42gh pr merge 42 --squash --delete-branchgh pr list --state opengh release create v1.0.0 --generate-notesgh release view v1.0.0 --web
gh codespace create --repo joinhashcode/workshopsgh codespace listgh codespace list --webCommandes à exécuter
| Fichier | Où | Rôle | Exemple |
|---|---|---|---|
README.md |
Racine | Vitrine : quoi, pourquoi, comment installer/lancer | Badges, installation, usage |
CONTRIBUTING.md |
Racine ou .github/ |
Comment contribuer : branches, commits, tests | CONTRIBUTING.md (racine) |
CODEOWNERS |
.github/ |
Reviewers auto par chemin | *.js @frontend |
CODE_OF_CONDUCT.md |
Racine ou .github/ |
Règles de communauté | Contributor Covenant |
LICENSE |
Racine | Légal : MIT, Apache, GPL | LICENSE (texte complet) |
SECURITY.md |
Racine ou .github/ |
Comment signaler une faille | Email privé |
FUNDING.yml |
.github/ |
Parrainage | GitHub Sponsors |
README.md minimal pro# Projet

## Installation
npm install
## Usage
npm run devCONTRIBUTING.md — extrait1. Fork → Branch `feat/xxx` depuis `main`2. Commits Conventional Commits3. Tests : npm test4. PR avec templateCODEOWNERS — exemple complet# Frontend*.js @joinhashcode/frontend-leads*.tsx @joinhashcode/frontend-leads
# Docs/docs/ @joinhashcode/docs-team*.md @joinhashcode/docs-team
# Infra/deploy/ @joinhashcode/devops-team* @joinhashcode/tech-leadsChoisir : https://choosealicense.com ou gh repo create --license mit
FUNDING.ymlgithub: [joinhashcode]patreon: joinhashcodeCommandes à exécuter
Dependabot (.github/dependabot.yml) — scanne package.json, ouvre PR auto si vulnérabilité
version: 2updates: - package-ecosystem: npm directory: '/' schedule: { interval: weekly }Secret Scanning — bloque le push si clé API/mot de passe détecté
Security Policy (SECURITY.md) — canal privé pour signaler :
# Security Policy
Email: security@joinhashcode.com — ne pas ouvrir d'issue publique..env → .gitignore + git-secrets + gitleaksgit commit -S -m "...") si exigéQu'est-ce qu'upstream ?
Cliquer pour révéler la réponseLe dépôt original officiel (joinhashcode) que vous avez forké. origin = votre fork.
Cliquer pour voir la questionCommande pour lier l'upstream ?
Cliquer pour révéler la réponsegit remote add upstream https://github.com/upstream/projet.git
Cliquer pour voir la questionComment sync son fork ?
Cliquer pour révéler la réponsegit fetch upstream → git switch main → git merge upstream/main → git push origin main (ou gh repo sync)
Cliquer pour voir la questionQue fait gh pr create --draft --fill ?
Cliquer pour révéler la réponseCrée une PR draft en remplissant titre/body depuis les commits.
Cliquer pour voir la questionÀ quoi sert CODEOWNERS ?
Cliquer pour révéler la réponseNotifie/requiert automatiquement des reviewers selon les fichiers (*.js → @frontend).
Cliquer pour voir la questionQuel fichier définit la licence ?
Cliquer pour révéler la réponseLICENSE à la racine (MIT, Apache, GPL).
Cliquer pour voir la questionRôle de Dependabot ?
Cliquer pour révéler la réponseScan les dépendances et propose des PR de mise à jour de sécurité.
Cliquer pour voir la questionOù signaler une faille ?
Cliquer pour révéler la réponseVia SECURITY.md (canal privé), pas une issue publique.
Cliquer pour voir la question1. Que fait git remote add upstream ?
2. Quel outil gère issues/PRs en CLI ?
3. Quel fichier définit les reviewers auto ?
4. Que fait Dependabot ?
# Fork workflowgh repo fork upstream/projet --clone --remotegit remote -v # origin + upstreamgit fetch upstream; git switch main; git merge upstream/main; git push origin maingh repo sync
# ghgh auth login; gh auth statusgh repo clone joinhashcode/workshopsgh issue list; gh issue create --title "bug"; gh issue view 42gh pr create --draft --fill; gh pr view --web; gh pr checkout 42; gh pr merge --squashgh release create v1.0.0 --generate-notesgh codespace create --repo joinhashcode/workshops
# Gouvernancels .github/CODEOWNERS CONTRIBUTING.md LICENSE SECURITY.mdcat .github/CODEOWNERSfetch upstream → merge → push origin.gh remplace le navigateur pour repo, issue, pr, release, codespace.README + CONTRIBUTING + CODEOWNERS + LICENSE + SECURITY.Dependabot + Secret Scanning + SECURITY.md (canal privé).Gouvernance posée, passons au versionnage sémantique et aux Releases GitHub.