Outils du site

Quand une plaisanterie a besoin d'explications, c'est qu'il vaut mieux ne pas la faire. [Coluche]

56-tools:git:server

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
56-tools:git:server [2023/11/21 18:28] – créée Roge56-tools:git:server [2023/11/21 19:03] (Version actuelle) Roge
Ligne 2: Ligne 2:
  
  
-Creation d'un utilisateur dédié sur le serveur:+===== Creation d'un utilisateur dédié sur le serveur =====
  
-<bash>+ 
 +<code bash>
 sudo adduser git sudo adduser git
 su git su git
Ligne 10: Ligne 11:
 mkdir .ssh && chmod 700 .ssh mkdir .ssh && chmod 700 .ssh
 touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
-</bash>+</code> 
 + 
 +On ajoute alors les clés utilisateurs dans ".ssh/authorized_keys" 
 + 
 +===== Initialisation d'un projet sur le server ===== 
 + 
 +<code bash> 
 +$ mkdir project.git 
 +$ cd project.git 
 +$ git init --bare 
 +hint: Using 'master' as the name for the initial branch. This default branch name 
 +hint: is subject to change. To configure the initial branch name to use in all 
 +hint: of your new repositories, which will suppress this warning, call: 
 +hint:  
 +hint: git config --global init.defaultBranch <name> 
 +hint:  
 +hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 
 +hint: 'development'. The just-created branch can be renamed via this command: 
 +hint:  
 +hint: git branch -m <name> 
 +Initialized empty Git repository in /media/bkp/GITs/project.git/ 
 +</code> 
 + 
 + 
 +===== Initialisation d'un projet pour un utilisateur  ===== 
 + 
 +<code bash> 
 +$ mkdir project 
 +$ cd project 
 +$ git init 
 +</code> 
 + 
 +Ensuite, après un commit :  
 + 
 +<code bash> 
 +git remote add origin git@gitserver:/srv/git/project.git 
 +</code> 
 + 
 +Cela peut aussi être intialisé dans le .git/config du projet : 
 +<code bash> 
 +[remote "origin"
 + url = git@gitserver:/srv/git/project.git 
 + fetch = +refs/heads/*:refs/remotes/origin/
 +</code> 
Dernière modification : 2023/11/21 18:28