{"id":7859,"date":"2026-04-27T09:18:59","date_gmt":"2026-04-27T08:18:59","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=7859"},"modified":"2026-05-06T12:55:21","modified_gmt":"2026-05-06T11:55:21","slug":"git-au-lycee","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/git-au-lycee\/","title":{"rendered":"Git au lyc\u00e9e"},"content":{"rendered":"\n<nav aria-label=\"Table des mati\u00e8res\" class=\"wp-block-table-of-contents\"><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#gestion-de-version-ou-versionning-en-jargon-informatique\">Gestion de version ou \u00ab\u00a0versionning\u00a0\u00bb en jargon informatique<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#presentation-de-l-outil-git\">Pr\u00e9sentation de l&rsquo;outil GIT<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#installation-sur-le-poste-etudiant-sous-linux\">installation  sur le poste \u00e9tudiant sous linux.<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#il-faut-ensuite-creer-le-depot-distant-sur-linux3\">Il faut ensuite cr\u00e9er le d\u00e9p\u00f4t distant sur linux3<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#lancons-un-projet-bonjour-le-monde-en-c\">Lan\u00e7ons un projet \u00ab\u00a0Bonjour le monde\u00a0\u00bb en C<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#compilation-avec-gcc-de-notre-code\">compilation avec gcc de notre code<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#lier-su-depot-distant-sur-linux3-local-au-lycee\">Lier su d\u00e9p\u00f4t distant sur linux3.local (au lyc\u00e9e)<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#envoyer-le-code-sur-le-serveur\">Envoyer le code sur le serveur<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#dans-un-autre-repertoire-on-va-cloner-le-projet\">Dans un autre r\u00e9pertoire  on va cloner le projet <\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#on-retourne-dans-notre-projet\">On retourne  dans notre projet <\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#utilisation-de-git\">Utilisation de git <\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/git-au-lycee\/#modifions-notre-projet\">modifions notre projet<\/a><\/li><\/ol><\/li><\/ol><\/nav>\n\n\n\n<h2 id=\"gestion-de-version-ou-versionning-en-jargon-informatique\" class=\"wp-block-heading\">Gestion de version ou \u00ab\u00a0versionning\u00a0\u00bb en jargon informatique<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Garder un historique complet<\/strong>\u00a0: savoir qui a modifi\u00e9 quoi, quand et pourquoi.<\/li>\n\n\n\n<li><strong>Revenir en arri\u00e8re<\/strong>\u00a0: restaurer une version ant\u00e9rieure d\u2019un fichier ou d\u2019un projet en cas d\u2019erreur.<\/li>\n\n\n\n<li><strong>Travailler \u00e0 plusieurs<\/strong>\u00a0: permettre \u00e0 plusieurs personnes de modifier simultan\u00e9ment les m\u00eames fichiers sans s\u2019\u00e9craser mutuellement.<\/li>\n\n\n\n<li><strong>Cr\u00e9er des branches<\/strong>\u00a0: d\u00e9velopper de nouvelles fonctionnalit\u00e9s en parall\u00e8le, sans toucher \u00e0 la version stable principale.<\/li>\n\n\n\n<li><strong>Fusionner<\/strong>\u00a0(merge) : r\u00e9int\u00e9grer proprement le travail fait sur une branche distincte.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"presentation-de-l-outil-git\" class=\"wp-block-heading\">Pr\u00e9sentation de l&rsquo;outil GIT<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Auteur : Linus Torvalds (cr\u00e9ateur du noyau Linux)<\/li>\n\n\n\n<li>Ann\u00e9e de cr\u00e9ation : 2005 (1er commit le 7 avril 2005)<\/li>\n\n\n\n<li>Contexte : Rupture de la licence gratuite de BitKeeper, l&rsquo;outil utilis\u00e9 jusque-l\u00e0 pour g\u00e9rer le noyau Linux<\/li>\n\n\n\n<li>D\u00e9lai de d\u00e9veloppement : 10 jours pour cr\u00e9er la premi\u00e8re version fonctionnelle (d\u00e9marr\u00e9e le 3 avril 2005)<\/li>\n\n\n\n<li>Mainteneur actuel : Junio Hamano (depuis le 26 juillet 2005)<\/li>\n\n\n\n<li>Version stable 1.0 : 21 d\u00e9cembre 2005<\/li>\n\n\n\n<li>Origine du nom : \u00ab\u00a0Git\u00a0\u00bb signifie \u00ab\u00a0imb\u00e9cile\u00a0\u00bb en argot britannique (choix provocateur de Linus)<\/li>\n<\/ul>\n\n\n\n<h2 id=\"installation-sur-le-poste-etudiant-sous-linux\" class=\"wp-block-heading\">installation  sur le poste \u00e9tudiant sous linux.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installation de l&rsquo;outil git sur la machine client (\u00e9tudiant)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">adapter (mettre votre email pro de la section) et votre pr\u00e9nom et nom <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Installer Git sous Debian\nsudo apt update\nsudo apt install git -y\n\n# Configurer git de l'utilisateur\ngit config --global user.name \"Pr\u00e9nom NOM\"\ngit config --global user.email \"prenom.nom@etu.univ.fr\"\ngit config --global init.defaultBranch main\ngit config --global core.editor \"vi\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config -l # pour v\u00e9rifier la config  ou git config --list<\/code><\/pre>\n\n\n\n<h2 id=\"il-faut-ensuite-creer-le-depot-distant-sur-linux3\" class=\"wp-block-heading\">Il faut ensuite cr\u00e9er le d\u00e9p\u00f4t distant sur linux3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dans le r\u00e9pertoire ~\/repos   et ici tp1 , tp2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Se connecter au serveur\nssh 1g1stuXX@linux3.local\n\n#la branche par d\u00e9faut sur le serveur \ngit config --global init.defaultBranch main\n\n# Cr\u00e9er le dossier des d\u00e9p\u00f4ts\nmkdir -p ~\/repos\ncd ~\/repos\n\n# Cr\u00e9er un d\u00e9p\u00f4t \"nu\" pour chaque TP\ngit init --bare hello-git.git\ngit init --bare tp1.git\ngit init --bare tp2.git\n\n\n# D\u00e9connecter\nexit<\/code><\/pre>\n\n\n\n<h2 id=\"lancons-un-projet-bonjour-le-monde-en-c\" class=\"wp-block-heading\">Lan\u00e7ons un projet \u00ab\u00a0Bonjour le monde\u00a0\u00bb en C<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">dans ~\/Works cr\u00e9er le r\u00e9pertoire tp1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/Works\/hello-git\ncd ~\/Works\/hello-git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">initialiser le git ! (pour utiliser git dans notre projet)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git init<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>etudiant@ordi:~\/Works\/hello-git$ git init\nD\u00e9p\u00f4t Git existant r\u00e9initialis\u00e9 dans \/home\/etudiant\/Works\/hello-git\/.git\/\netudiant@ordi:~\/Works\/hello-git$ \n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">un r\u00e9pertoire cach\u00e9 .git est install\u00e9 dans votre r\u00e9pertoire pour que git puisse g\u00e9rer votre projet <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">on va y mettre un code c avec vi de pr\u00e9f\u00e9rence.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#include &lt;stdio.h>\n#include &lt;stdlib.h>\n\nint main() \n{\n    printf(\"Hello World!\\n\");\n    return EXIT_SUCCESS;\n}<\/pre>\n\n\n\n<h3 id=\"compilation-avec-gcc-de-notre-code\" class=\"wp-block-heading\">compilation avec gcc de notre code<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gcc hello.c -o hello\n.\/hello\nHello World!\netudiant@ordi:~\/Works\/tp1$ \n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Voir ce qui a \u00e9t\u00e9 cr\u00e9\u00e9\ngit status<\/code><\/pre>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>on obtient<\/summary>\n<pre class=\"wp-block-code\"><code>Sur la branche master\n\nAucun commit\n\nFichiers non suivis:\n  (utilisez \"git add &lt;fichier>...\" pour inclure dans ce qui sera valid\u00e9)\n\thello\n\thello.c\n\naucune modification ajout\u00e9e \u00e0 la validation mais des fichiers non suivis sont pr\u00e9sents (utilisez \"git add\" pour les suivre)\n<\/code><\/pre>\n<\/details>\n\n\n\n<pre class=\"wp-block-code\"><code># Ajouter le fichier au versionnement\ngit add hello.c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Valider (premier commit)\ngit commit -m \"Ajout de hello.c - programme Hello World\"<\/code><\/pre>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>on obtient<\/summary>\n<pre class=\"wp-block-code\"><code>&#91;master (commit racine) 98ce721] Ajout de hello.c - programme Hello World\n\n\n<\/code><\/pre>\n<\/details>\n\n\n\n<h2 id=\"lier-su-depot-distant-sur-linux3-local-au-lycee\" class=\"wp-block-heading\">Lier su d\u00e9p\u00f4t distant sur linux3.local (au lyc\u00e9e)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>git remote add origin ssh:\/\/AgGstuXX@linux3.local:\/home\/AgGstuXX\/repos\/hello-git.git<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A     : ann\u00e9e 1 ou 2<\/li>\n\n\n\n<li>G     : groupe 1 ou 2<\/li>\n\n\n\n<li>XX  : poste de 00 \u00e0 14 <\/li>\n<\/ul>\n\n\n\n<h2 id=\"envoyer-le-code-sur-le-serveur\" class=\"wp-block-heading\">Envoyer le code sur le serveur<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>git push -u origin main<\/code><\/pre>\n\n\n\n<h2 id=\"dans-un-autre-repertoire-on-va-cloner-le-projet\" class=\"wp-block-heading\">Dans un autre r\u00e9pertoire  on va cloner le projet <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">on peut dans \/tmp  .. par  exemple , c&rsquo;est juste pour tester ! on effacera ensuite<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone AgGstuXX@linux3.local:\/home\/AgGstuXX\/repos\/hello-git.git<\/code><\/pre>\n\n\n\n<h2 id=\"on-retourne-dans-notre-projet\" class=\"wp-block-heading\">On retourne  dans notre projet <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">on va ajouter un fichier README<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">on peut v\u00e9rifier le remote <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git remote -v\norigin\tssh:\/\/AgGstuXX@linux3.local:\/home\/AgGstuXX\/repos\/hello-git.git (fetch)\norigin\tssh:\/\/AgGstuXX@linux3.local:\/home\/AgGstuXX\/repos\/hello-git.git (push)\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">avec vi cr\u00e9er le fichier README<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Texte dans le fichier README\npour tester<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>git add .  # ou git add README  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">puis commit ! (valider)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git commit -m \"ajout du fichier README\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">et on pousse le git sur linux3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push origin main<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">la sauvegarde du git mise \u00e0 jour, vous allez v\u00e9rifier en recommen\u00e7ant le clone dans le r\u00e9pertoire \/tmp<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Vous disposez d&rsquo;un git de votre projet<\/p>\n\n\n\n<h2 id=\"utilisation-de-git\" class=\"wp-block-heading\">Utilisation de git <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons imaginer que du temps c&rsquo;est pass\u00e9 !! et que vous avez envie de r\u00e9cup\u00e9rer votre projet et le modifier<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/works\nrm hello-git -rf #on supprime le projet .. le temps \u00e0 pass\u00e9 !<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">puis &#8230; des ann\u00e9es  plus tard on r\u00e9cup\u00e8re le clone<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone AgGstuXX@linux3.local:\/home\/AgGstuXX\/repos\/hello-git.git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Avec git clone, on retrouve notre projet exactement comme on l&rsquo;avait laiss\u00e9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">c&rsquo;est l\u2019int\u00e9r\u00eat de git !<\/p>\n\n\n\n<h3 id=\"modifions-notre-projet\" class=\"wp-block-heading\">modifions notre projet<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">on va modifier le fichier README (vi ou autre pour modfier )<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd hello-git.git\necho \"ajout d'une ligne dans le fichier README\" >> README<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>git add README<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Et on valide  (commit)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git commit -m \"Correction du README\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">et on repousse dans le git<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">on peut pr\u00e9ciser <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push origin main<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gestion de version ou \u00ab\u00a0versionning\u00a0\u00bb en jargon informatique Pr\u00e9sentation de l&rsquo;outil GIT installation sur le poste \u00e9tudiant sous linux. Installation de l&rsquo;outil git sur la machine client (\u00e9tudiant) adapter (mettre votre email pro de la section) et votre pr\u00e9nom et nom Il faut ensuite cr\u00e9er le d\u00e9p\u00f4t distant sur linux3 Dans le r\u00e9pertoire ~\/repos et [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-7859","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Gestion de version ou \u00ab\u00a0versionning\u00a0\u00bb en jargon informatique Pr\u00e9sentation de l&rsquo;outil GIT installation sur le poste \u00e9tudiant sous linux. Installation de l&rsquo;outil git sur la machine client (\u00e9tudiant) adapter (mettre votre email pro de la section) et votre pr\u00e9nom et nom Il faut ensuite cr\u00e9er le d\u00e9p\u00f4t distant sur linux3 Dans le r\u00e9pertoire ~\/repos et\u2026","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/7859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=7859"}],"version-history":[{"count":31,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/7859\/revisions"}],"predecessor-version":[{"id":8011,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/7859\/revisions\/8011"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=7859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}