gitmanagewebsite
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
gitmanagewebsite [2015/06/10 19:10] – luc | gitmanagewebsite [2018/10/13 20:32] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ===== MANAGER UN SITE WEB VIA GIT ===== | ||
+ | ==== Objectif ==== | ||
+ | J'ai un beau site web sur un serveur, et je souhaite l' | ||
+ | Si possible, je veux avoir une journalisation (versioning) des modifs, avec des branches de dev qui ne changent pas le site web (pour avoir le temps de tester) | ||
+ | |||
+ | ==== Problématique ==== | ||
+ | git est un super cvs, mais les fichiers ne sont pas facilement accessibles pour etre servis directement par un serveur web, en d' | ||
+ | |||
+ | |||
+ | ==== Solution ==== | ||
+ | |||
+ | Source : http:// | ||
+ | |||
+ | Tout d' | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git init | ||
+ | git add . | ||
+ | git commit -m" | ||
+ | </ | ||
+ | |||
+ | ensuite créer un dépot " | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git init --bare | ||
+ | </ | ||
+ | |||
+ | et lier les 2 : | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git remote add hub / | ||
+ | git remote show hub # pour vérifier | ||
+ | git push hub master | ||
+ | </ | ||
+ | |||
+ | Ensuite, il faut gérer le hook '' | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | # editer le fichier post-update pour mettre : | ||
+ | </ | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | |||
+ | echo | ||
+ | echo "**** Pulling changes into Prime [Hub's post-update hook]" | ||
+ | echo | ||
+ | |||
+ | cd / | ||
+ | unset GIT_DIR | ||
+ | git pull hub master | ||
+ | |||
+ | exec git-update-server-info | ||
+ | </ | ||
+ | |||
+ | voilà, c'est bon |