Cours RechercherCtrl K

Fiches de révision Git & GitHub

Fiche : Publier sur GitHub

Git & GitHub · Leçon 5

Publier sur GitHub

À retenir

  • git remote add origin adresse relie le dépôt local au dépôt en ligne.
  • git push -u origin main envoie les commits (le -u retient le lien) ; git pull récupère ceux des autres.
  • git clone adresse copie un dépôt existant, avec tout son historique.
  • En équipe : une branche par modification, git push -u origin branche, puis une pull request sur GitHub.
  • Rythme : git pull en commençant, add / commit, git push à la fin d'une étape.

Mémo

git remote add origin https://github.com/moi/projet.git
git push -u origin main
git pull

git clone https://github.com/equipe/site.git
cd site
git switch -c correction
# … add, commit …
git push -u origin correction

Pièges à éviter

  • Taper son mot de passe GitHub dans le terminal : il faut un token ou une clé SSH.
  • Pousser directement sur main dans un projet d'équipe.
  • Oublier cd après un git clone.

Revoir la leçon et ses exercices