«

»

Fév 08

[Gandi] [Git] Déploiement par objet/branche

[Gandi] [Git] Déploiement par objet/branche.

1/ Répertoire de travail :

[~] ➔ mkdir GITTAG
[~] ➔ cd GITTAG/
[~/GITTAG] ➔ 

2/ Création du répertoire du site internet :

[~/GITTAG] ➔ mkdir htdocs

3/ Création d’un fichier :

Ouvrir :

htdocs/index.php

Ajouter :

<html>
<head>
</head>
<body>
Branche master
</body>
</html>

4/ Création d’un dépôt git :

– Initialisation :

[~/GITTAG] ➔ git init .
Initialized empty Git repository in /home/sam/GITTAG/.git/

– Ajout de fichier :

[~/GITTAG] ➔ git add -A

– Commit :

[~/GITTAG] ➔ git commit -m "Master branch"
[master (root-commit) 5523182] Master branch
 1 file changed, 7 insertions(+)
 create mode 100644 htdocs/index.php

– Ajout de la branche distante :

[~/GITTAG] ➔ git remote add origin git+ssh://1188119@git.dc2.gpaas.net/8ed4f7fb20.testurl.ws.git

– Pusher les modifications :

[~/GITTAG] ➔ git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 302 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To git+ssh://1188119@git.dc2.gpaas.net/8ed4f7fb20.testurl.ws.git
 * [new branch]      master -> master

– Déploiement du site :

[~/GITTAG] ➔ ssh 1188119@git.dc2.gpaas.net 'deploy 8ed4f7fb20.testurl.ws.git'
initializing builder
................builder ready
...
-----> Build complete
-----> Cleaning temporary files

– Test du site :

[~/GITTAG] ➔ curl http://8ed4f7fb20.testurl.ws/
<html>
<head>
</head>
<body>
Branche master
</body>
</html>

– Vérification de la branche :

[~/GITTAG] ➔ git status
On branch master
nothing to commit, working directory clean

5/ Création d’un branche de développement :

[~/GITTAG] ➔ git checkout -B develop
Switched to a new branch 'develop'

Ouvrir :

htdocs/index.php

Ajouter :

<html>
<head>
</head>
<body>
Branche develop
</body>
</html>
[~/GITTAG] ➔ git add -A
[~/GITTAG] ➔ git commit -m "Develop branch"
[develop 8f4598d] Develop branch
 1 file changed, 1 insertion(+), 1 deletion(-)
[~/GITTAG] ➔ git push origin develop
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 332 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To git+ssh://1188119@git.dc2.gpaas.net/8ed4f7fb20.testurl.ws.git
 * [new branch]      develop -> develop
[~/GITTAG] ➔ ssh 1188119@git.dc2.gpaas.net 'deploy 8ed4f7fb20.testurl.ws.git develop'
initializing builder
..............builder ready
...
-----> Build complete
-----> Cleaning temporary files
[~/GITTAG] ➔ curl http://8ed4f7fb20.testurl.ws/
<html>
<head>
</head>
<body>
Branche develop
</body>
</html>
[~/GITTAG] ➔ git status
On branch develop
nothing to commit, working directory clean
[~/GITTAG] ➔ git branch
* develop
  master

6/ Re-déploiement de la branche master :

[~/GITTAG] ➔ ssh 1188119@git.dc2.gpaas.net 'deploy 8ed4f7fb20.testurl.ws.git master'
initializing builder
................builder ready
...
-----> Build complete
-----> Cleaning temporary files
[~/GITTAG] ➔ curl http://8ed4f7fb20.testurl.ws/
<html>
<head>
</head>
<body>
Branche master
</body>
</html>