Gitosis2Gitolite
- Doc :
- installation et config
J'ai dû me créer une nouvelle paire de clé ssh pour ma connexion gitolite
you probably supplied a key which already has shell access to the server. That won't work; you'll have to generate and use a different key pair for gitolite access
côté serveur
test-git:/srv# apt-get install gitolite test-git:/srv# dpkg-reconfigure gitolite ==> username : gitolite ==> homedir : /srv/gitolite ==> admin key : /srv/super-mnombre.pub (nouvelle clé pub de l'admin mnombre) ********* ... could not symlink /srv/gitolite/.gitolite/hooks/common/gitolite-hooked to ./gitolite-admin.git/hooks *** FATAL *** admin.pub maps to no access, not admin. You will not be able to access gitolite with this key. Look for the 'ssh troubleshooting' link in http://sitaramc.github.com/gitolite/. test-git:/srv# *************** test-git:/srv# cp -av /srv/gitosis/repositories /srv/gitolite/ test-git:/srv# chown -R gitolite: /srv/gitolite/repositories test-git:/srv# su - gitolite (auto-config de GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL) gitolite@test-git:~$ ls -al total 28 drwxr-xr-x 5 gitolite gitolite 4096 mar 23 21:49 . drwxr-xr-x 7 root root 4096 mar 23 21:49 .. drwx------ 8 gitolite gitolite 4096 mar 23 21:49 .gitolite -rw-r--r-- 1 gitolite gitolite 4217 mar 23 21:49 .gitolite.rc drwxr-xr-x 149 gitolite gitolite 4096 mar 3 2015 repositories drwx------ 2 gitolite gitolite 4096 mar 23 21:49 .ssh gitolite@test-git:~$ #initialise the gitolite repository gitolite@test-git:~$ gl-setup creating gitolite-admin... Initialized empty Git repository in /srv/gitolite/repositories/gitolite-admin.git/ gitolite@test-git:~$ exit test-git:/srv# adduser gitolite ssh
- côté poste admin (poste client)
Clone
mnombre@u-nm:~$ git clone ssh://gitolite@199.84.140.58/gitolite-admin Clonage dans 'gitolite-admin'... warning: Vous semblez avoir cloné un dépôt vide. Vérification de la connectivité... fait. mnombre@u-nm:~$ cd gitolite-admin/ mnombre@u-nm:~/gitolite-admin$ ls -al total 12 drwxrwxr-x 3 mnombre mnombre 4096 mar 10 15:07 . drwx------ 51 mnombre mnombre 4096 mar 10 15:07 .. drwxrwxr-x 7 mnombre mnombre 4096 mar 10 15:07 .git mnombre@u-nm:~/gitolite-admin$ ls -al .git/ total 40 drwxrwxr-x 7 mnombre mnombre 4096 mar 10 15:07 . drwxrwxr-x 3 mnombre mnombre 4096 mar 10 15:07 .. drwxrwxr-x 2 mnombre mnombre 4096 mar 10 15:07 branches -rw-rw-r-- 1 mnombre mnombre 268 mar 10 15:07 config -rw-rw-r-- 1 mnombre mnombre 73 mar 10 15:07 description -rw-rw-r-- 1 mnombre mnombre 23 mar 10 15:07 HEAD drwxrwxr-x 2 mnombre mnombre 4096 mar 10 15:07 hooks drwxrwxr-x 2 mnombre mnombre 4096 mar 10 15:07 info drwxrwxr-x 4 mnombre mnombre 4096 mar 10 15:07 objects drwxrwxr-x 4 mnombre mnombre 409
Copie des clés ssh
mnombre@u-nm:~/gitolite-admin$ cp -av ../gitosis-admin/keydir .
changement de ma clé (je mets ma nouvelle clé spécifique gitolite)
mnombre@u-nm:~/gitolite-admin$ rm keydir/moussa.nombre.pub; cp ~mnombre/.ssh/nm_gitolite.pub keydir/moussa.nombre.pub
Utiliser un compte spécifique, genre super-mnombre (cf igc ;))
Convert
mnombre@u-nm:~/gitolite-admin$ scp 199.84.140.58:/usr/share/gitolite/gl-conf-convert /home/mnombre/Bureau/ gl-conf-convert 100% 3396 3.3KB/s 00:00 mnombre@u-nm:~$ ~mnombre/Bureau/gl-conf-convert < gitosis-admin/gitosis.conf >> gitolite-admin/conf/gitolite.conf mnombre@u-nm:~$
Be sure to check the file to make sure it converted correctly http://gitolite.com/gitolite/gitolite.html#gsmigr
==> j'ai refait la réorganisation en remettant les titres aux bons endroits mais surtout supprimé les entrées dans la catégorie gitweb pour les dépôts à ne pas publier.
==> modifier les références aux groupes (_auf-ari-it --> @auf-ari-it)
==> Premier push réussi
mnombre@u-nm:~/gitolite-admin$ git push Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 384 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: creating auf-gestion-materiel... remote: Initialized empty Git repository in /srv/gitolite/repositories/auf-gestion-materiel.git/ remote: creating auf_cuf... remote: Initialized empty Git repository in /srv/gitolite/repositories/auf_cuf.git/ remote: creating auf_ific_annuaires... remote: Initialized empty Git repository in /srv/gitolite/repositories/auf_ific_annuaires.git/ remote: creating bmo... remote: Initialized empty Git repository in /srv/gitolite/repositories/bmo.git/ remote: creating eric... remote: Initialized empty Git repository in /srv/gitolite/repositories/eric.git/ remote: creating intranet_liferay... remote: Initialized empty Git repository in /srv/gitolite/repositories/intranet_liferay.git/ remote: WARNING: pubkey files should end with ".pub", ignoring dorina.mosku.pub.old remote: remote: ***** WARNING ***** remote: You have 20 pubkeys that do not appear to be used in any access rules remote: remote: ***** WARNING ***** remote: the following users have no pubkeys: remote: abdelkader.eddoud,jean-jadot.ondobo,jerome.santini,massamba.gaye,morad.bouaoud,serghei.mihai,vutha.keth To ssh://gitolite@199.84.140.58/gitolite-admin f8ed45f..ff3fa8f master -> master mnombre@u-nm:~/gitolite-admin$
côté serveur : adapter la config gitweb
diff --git a/etc/gitweb.conf b/etc/gitweb.conf index 68e8e01..c99a789 100644 --- a/etc/gitweb.conf +++ b/etc/gitweb.conf @@ -1,6 +1,6 @@ # path to git projects (<project>.git) #$projectroot = "/var/cache/git"; -$projectroot = "/srv/gitosis/repositories"; +$projectroot = "/srv/gitolite/repositories"; # directory to use for temp files $git_temp = "/tmp"; @@ -16,23 +16,23 @@ $site_name = "Dépôts git de l'AuF"; # file with project list; by default, simply scan the projectroot dir. + $projects_list = $projectroot; -$projects_list = "/srv/gitosis/gitosis/projects.list"; $projects_list_description_width = 50; $export_ok = ""; $strict_export = "true"; @git_base_url_list = ('git://git.auf.org'); # stylesheet to use -$stylesheet = "gitweb.css"; +$stylesheet = "static/gitweb.css"; # javascript code for gitweb -$javascript = "gitweb.js"; +$javascript = "static/gitweb.js"; # logo to use -$logo = "git-logo.png"; +$logo = "static/git-logo.png"; # the 'favicon' -$favicon = "git-favicon.png"; +$favicon = "static/git-favicon.png"; # tout est Unicode par défaut $default_text_plain_charset = "utf-8";
diff --git a/etc/gitweb-prive.conf b/etc/gitweb-prive.conf index 4be4717..415bbcc 100644 --- a/etc/gitweb-prive.conf +++ b/etc/gitweb-prive.conf @@ -1,6 +1,6 @@ # path to git projects (<project>.git) #$projectroot = "/var/cache/git"; -$projectroot = "/srv/gitosis/repositories"; +$projectroot = "/srv/gitolite/repositories"; # directory to use for temp files $git_temp = "/tmp"; @@ -19,23 +19,23 @@ $site_name = "Dépôts git de l'AuF"; # file with project list; by default, simply scan the projectroot dir. #$projects_list = $projectroot; -$projects_list = "/srv/gitosis/gitosis/projects-prive.list"; +$projects_list = "/srv/gitolite/gitolite/projects-prive.list"; $projects_list_description_width = 50; $export_ok = ""; $strict_export = "true"; @git_base_url_list = ('git://git.auf.org'); # stylesheet to use -$stylesheet = "gitweb.css"; +$stylesheet = "static/gitweb.css"; # javascript code for gitweb -$javascript = "gitweb.js"; +$javascript = "static/gitweb.js"; # logo to use -$logo = "git-logo.png"; +$logo = "static/git-logo.png"; # the 'favicon' -$favicon = "git-favicon.png"; +$favicon = "static/git-favicon.png"; # tout est Unicode par défaut $default_text_plain_charset = "utf-8";
test-git:/srv# mv gitosis gitosis-FRIGO test-git:/srv# cp gitosis-FRIGO/gitosis/projects-prive.list gitolite/ test-git:/srv# chown gitolite: gitolite/projects-prive.list
.... On n'a rien sur l'interface web :(..., juste un "404 - No projects"
- j'ai dû dé-commenter "$projects_list = $projectroot;". Donc voir où se trouve le soucis dans le projects.list.
https://ao2.it/wiki/How_to_setup_a_GIT_server_with_gitolite_and_gitweb (tout à la fin)
Now test the setup pointing the browser to git.example.com, if you get a 404 - No projects found there could be some filesystem permission issues, gitolite sets mode 0750 on projects dirs, you can add the www-data user to the git group, so gitweb can access the git repositories in read only mode. adduser www-data git
dpkg-reconfigure gitolite des erreurs (du fait que ce soit fait sous root ?): test-git:/srv/gitosis# dpkg-reconfigure gitolite creating gitolite-admin... fatal: GIT_WORK_TREE (or --work-tree=<directory>) not allowed without specifying GIT_DIR (or --git-dir=<directory>) could not symlink /srv/gitolite/.gitolite/hooks/common/gitolite-hooked to hooks fatal: Not a git repository: '/.git' error: could not lock config file /.git/config: Permission non accord?e error: could not lock config file /.git/config: Permission non accord?e fatal: Not a git repository: '/.git' could not symlink /srv/gitolite/.gitolite/hooks/common/gitolite-hooked to ./gitolite-admin.git/hooks fprint failed mais dossier créé : test-git:/srv/gitosis#ls -al /srv/gitolite/ total 28 drwxr-xr-x 5 gitolite gitolite 4096 mar 10 11:15 . drwxr-xr-x 7 root root 4096 mar 10 11:15 .. drwx------ 8 gitolite gitolite 4096 mar 10 11:15 .gitolite -rw-r--r-- 1 gitolite gitolite 4217 mar 10 11:15 .gitolite.rc drwx------ 3 gitolite gitolite 4096 mar 10 11:15 repositories drwx------ 2 gitolite gitolite 4096 mar 10 11:15 .ssh test-git:/srv/gitosis#
- problème ssh
WARNING: keydir/<yourname>.pub duplicates a non-gitolite key, sshd will ignore it You used a key that is already set to give you shell access. You cannot use the same key to get shell access as well as access gitolite repos. Solution: use a different keypair for gitolite. There's a wee bit more on this in the setup section of the install page. Also see why bypassing causes a problem and both the pages linked from ssh for background. 2.1.2.5 setup For the first-time setup, you need to have a public key file (usually from the admin's workstation) ready. If the main gitolite admin's username is "alice", this file should be named "alice.pub" and copied to the server. Once that is done, run: gitolite setup -pk alice.pub If that completes without any warnings, you are done. If it had a warning, you probably supplied a key which already has shell access to the server. That won't work; you'll have to generate and use a different key pair for gitolite access and use host aliases to distinguish between the two. While you're there, read both the ssh pages. Twice.
ajout de compte admin (s'inspirer de comment changer une clé)
If you lost your gitolite admin key or access, here's what you do. We'll assume your username is "alice" (i.e., alice has RW or RW+ permissions on the gitolite-admin repo). Make yourself a new keypair and copy the public key to the server as 'alice.pub'. Log on to the server, and run gitolite setup -pk alice.pub. That's it; the new alice.pub file replaces whatever existed in the repo before.