This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docpublic:systemes:linux:git [2013/04/09 13:12] PROCACCIA [git bare server repo] |
docpublic:systemes:linux:git [2013/04/09 13:54] (current) PROCACCIA |
||
---|---|---|---|
Line 2: | Line 2: | ||
===== GIT ===== | ===== GIT ===== | ||
- | ===== Reference | + | ===== References |
* http:// | * http:// | ||
Line 11: | Line 11: | ||
* http:// | * http:// | ||
* http:// | * http:// | ||
+ | * http:// | ||
===== Configuration locale ===== | ===== Configuration locale ===== | ||
Line 222: | Line 223: | ||
$ git log | $ git log | ||
commit 9c17567714d9158126d39d3b1dda20ebe5146d82 | commit 9c17567714d9158126d39d3b1dda20ebe5146d82 | ||
- | Author: jehanproc <jehan.procaccia@int-evry.fr> | + | Author: jehanproc <my.email@int-evry.fr> |
Date: Tue Apr 9 11:18:36 2013 +0200 | Date: Tue Apr 9 11:18:36 2013 +0200 | ||
Line 228: | Line 229: | ||
commit b679adb3b2e2fa5e30d1f52b2fa4f12cff888b66 | commit b679adb3b2e2fa5e30d1f52b2fa4f12cff888b66 | ||
- | Author: jehanproc <jehan.procaccia@int-evry.fr> | + | Author: jehanproc <my.email@int-evry.fr> |
Date: Tue Apr 9 09:51:01 2013 +0200 | Date: Tue Apr 9 09:51:01 2013 +0200 | ||
Line 243: | Line 244: | ||
$ git log | $ git log | ||
commit b679adb3b2e2fa5e30d1f52b2fa4f12cff888b66 | commit b679adb3b2e2fa5e30d1f52b2fa4f12cff888b66 | ||
- | Author: jehanproc <jehan.procaccia@int-evry.fr> | + | Author: jehanproc <my.email@int-evry.fr> |
Date: Tue Apr 9 09:51:01 2013 +0200 | Date: Tue Apr 9 09:51:01 2013 +0200 | ||
Line 331: | Line 332: | ||
- | [procacci@arvouin ~/.ssh] | + | [login@arvouin ~/.ssh] |
$ ssh-copy-id gituser@svnshare.it-sudparis.eu | $ ssh-copy-id gituser@svnshare.it-sudparis.eu | ||
</ | </ | ||
Line 351: | Line 352: | ||
</ | </ | ||
+ | au sujet de git-shell-commands cf http:// | ||
==== git bare server repo ==== | ==== git bare server repo ==== | ||
+ | |||
+ | on creer un repository vierge sur le serveur | ||
< | < | ||
Line 362: | Line 366: | ||
- | ==== git remote client ==== | + | ===== initialisation |
- | sur le client on declare notre serveur remote qui va heberger notre repo; git remote add [nomcourt] [url] | + | sur le client on declare notre serveur remote qui va heberger notre repo |
+ | |||
+ | ==== remote add ==== | ||
+ | |||
+ | syntaxe: | ||
< | < | ||
Line 407: | Line 415: | ||
</ | </ | ||
+ | ===== usages client remote ===== | ||
+ | |||
+ | depuis un (autre) client (teststud) on va recuperer ce repo et le modifier | ||
+ | |||
+ | < | ||
+ | $ ssh-copy-id gituser@gitshare.tem-tsp.eu | ||
+ | |||
+ | $ git clone ssh:// | ||
+ | Cloning into ' | ||
+ | remote: Counting objects: 12, done. | ||
+ | remote: Compressing objects: 100% (4/4), done. | ||
+ | remote: Total 12 (delta 1), reused 0 (delta 0) | ||
+ | Receiving objects: 100% (12/12), done. | ||
+ | Resolving deltas: 100% (1/1), done. | ||
+ | -bash-4.2$ ls | ||
+ | gittuto | ||
+ | -bash-4.2$ cd gittuto/ | ||
+ | -bash-4.2$ ls | ||
+ | file1.txt | ||
+ | -bash-4.2$ git remote -v | ||
+ | origin ssh:// | ||
+ | origin ssh:// | ||
+ | </ | ||
+ | |||
+ | modifications et ajouts locaux | ||
+ | |||
+ | < | ||
+ | -bash-4.2$ vim file2.txt | ||
+ | -bash-4.2$ git add file2.txt | ||
+ | -bash-4.2$ git commit -a -m "add file2" | ||
+ | [master 9287d44] add file2 | ||
+ | |||
+ | 1 files changed, 2 insertions(+), | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ==== push remote ==== | ||
+ | |||
+ | on envoie sur le serveur nos modifications | ||
+ | |||
+ | < | ||
+ | -bash-4.2$ git push | ||
+ | Counting objects: 4, done. | ||
+ | Delta compression using up to 2 threads. | ||
+ | Compressing objects: 100% (2/2), done. | ||
+ | Writing objects: 100% (3/3), 307 bytes, done. | ||
+ | Total 3 (delta 0), reused 0 (delta 0) | ||
+ | To ssh:// | ||
+ | | ||
+ | </ | ||
+ | |||
+ | sur le serveur, c'est encore le directory " | ||
+ | |||
+ | < | ||
+ | [root@gitshare gittuto.git]# | ||
+ | drwxrwxr-x | ||
+ | drwxrwxr-x 19 gituser gituser 4096 Apr 9 15:26 objects | ||
+ | </ | ||
+ | |||
+ | ==== pull remote ==== | ||
+ | |||
+ | depuis notre premier client nous allons recuperer les modifications faites par le second client (teststud) | ||
+ | |||
+ | === visualisation de l'etat remote === | ||
+ | |||
+ | < | ||
+ | $ git remote show tuto | ||
+ | * remote tuto | ||
+ | Fetch URL: ssh:// | ||
+ | Push URL: ssh:// | ||
+ | HEAD branch: master | ||
+ | Remote branch: | ||
+ | master tracked | ||
+ | Local ref configured for 'git push': | ||
+ | master pushes to master (local out of date) | ||
+ | </ | ||
+ | |||
+ | on note le " | ||
+ | |||
+ | === recuperation === | ||
+ | |||
+ | on recupere (pull) depuis le serveur les dernieres modifications du repo " | ||
+ | |||
+ | < | ||
+ | $ git pull tuto master | ||
+ | From ssh:// | ||
+ | * branch | ||
+ | Updating 8fedaa6..9287d44 | ||
+ | Fast-forward | ||
+ | | ||
+ | 1 files changed, 2 insertions(+), | ||
+ | | ||
+ | |||
+ | $ ls | ||
+ | file1.txt | ||
+ | |||
+ | </ |