Difference between revisions of "Gitolite"
From Fixme.ch
Binary Brain (Talk | contribs) |
|||
| (26 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | [[Category:Services]] | |
| − | + | ||
| − | + | {{warning| This project is now deprecated.}} | |
| − | ** The gitolite admin | + | {{warning| Gitolite is now in read-only mode as we are migrating to [http://gogs.io/ Gogs]. Our Gogs instance is available at https://git.fixme.ch/. See [[Git]] or ask [[User:dgellow]] for more informations.}} |
| − | ** | + | |
| + | == Goal == | ||
| + | * Provides GIT repositories to the members. | ||
| + | * https://github.com/sitaramc/gitolite/wiki | ||
| + | |||
| + | == Usage == | ||
| + | * Access a repository like this: | ||
| + | git clone ssh://gitolite@git.fixme.ch:1337/$example | ||
| + | * List repositories you can access | ||
| + | ssh gitolite@foo.fixme.ch -p 1337 | ||
| + | |||
| + | == Administration == | ||
| + | * Ask The following people to access the gitolite admin : | ||
| + | RW = nemen | ||
| + | RW = malik | ||
| + | RW = rorist | ||
| + | RW = francois | ||
| + | RW = anael | ||
| + | RW = crazygolem | ||
| + | RW = prosouth | ||
| + | RW = artphi | ||
| + | === Create a repo === | ||
| + | * Get the gitolite admin | ||
| + | git clone ssh://gitolite@git.fixme.ch:1337/gitolite-admin | ||
| + | * Edit conf/gitolite.conf, add your repo and permissions | ||
| + | repo MySuperProject | ||
| + | R = @all #pull | ||
| + | RW = myuser #push | ||
| + | RW+ = myuser #rewrite history | ||
| + | * Commit and push to foo | ||
| + | git commit -am "Add XXX repo" | ||
| + | git push origin master | ||
| + | |||
| + | === Add user === | ||
| + | * Ask the user to create an ssh key and to give the public key | ||
| + | ssh-keygen | ||
| + | cat ~/.ssh/id_rsa.pub | ||
| + | * Create a new file for the key in keydir | ||
| + | echo 'ssh-rsa AAA[...]' > keydir/name@machine.pub | ||
| + | git add keydir/name@machine.pub | ||
| + | git commit -am "new key for name" | ||
| + | git push origin master | ||
| + | |||
| + | == Tip == | ||
| + | If you don't want to specify the port every time you use ssh/git, you can add the host to your '''~/.ssh/config''': | ||
| + | |||
| + | Host git.fixme.ch | ||
| + | Port 1337 | ||
| + | == Deploy == | ||
| + | * There is a git hook to publish most of the application in production. | ||
| + | * The deploy hook is located at <code>/home/git/hooks/deploy.sh</code> in the [[Internal_Server]]. | ||
| + | * You must add a <code>post-receive</code> hook in your project in a file <code>/home/git/repositories/yourproject/hooks/post-receive</code> with the following content: | ||
| + | DIR=/path/to/project #example: /var/www/foo/htdocs | ||
| + | APP=user-to-chown-to #example: www-data | ||
| + | /home/git/hooks/deploy.sh $APP $DIR | ||
| + | * Permissions fix for the hooks and repo | ||
| + | chmod +x /home/git/repositories/yourproject/hooks/post-receive | ||
| + | chown gitolite:gitolite /home/git/repositories/yourproject/hooks/post-receive | ||
| + | chown -R gitolite:$APP /path/to/project | ||
| + | find /path/to/project -type f -exec chmod 640 {} \; | ||
| + | find /path/to/project -type d -exec chmod 750 {} \; | ||
| + | * It's also a good thing to have a check of the database when you launch the application, and automatically create it if it doesn't yet exist. | ||
| + | |||
| + | == How to use git ? == | ||
| + | If you come from svn, forget all that you have learnt, and start from scratch. A good start would be to do the http://git-scm.com/ tutorial. | ||
| + | Some good ressources to learn git includes: | ||
| + | * http://ftp.newartisans.com/pub/git.from.bottom.up.pdf | ||
| + | * http://eagain.net/articles/git-for-computer-scientists/ | ||
| + | |||
| + | == See also == | ||
| + | * [[Git_talk]] | ||
Latest revision as of 17:17, 22 February 2022
| This project is now deprecated. |
| Gitolite is now in read-only mode as we are migrating to Gogs. Our Gogs instance is available at https://git.fixme.ch/. See Git or ask User:dgellow for more informations. |
Contents
Goal
- Provides GIT repositories to the members.
- https://github.com/sitaramc/gitolite/wiki
Usage
- Access a repository like this:
git clone ssh://gitolite@git.fixme.ch:1337/$example
- List repositories you can access
ssh gitolite@foo.fixme.ch -p 1337
Administration
- Ask The following people to access the gitolite admin :
RW = nemen
RW = malik
RW = rorist
RW = francois
RW = anael
RW = crazygolem
RW = prosouth
RW = artphi
Create a repo
- Get the gitolite admin
git clone ssh://gitolite@git.fixme.ch:1337/gitolite-admin
- Edit conf/gitolite.conf, add your repo and permissions
repo MySuperProject
R = @all #pull
RW = myuser #push
RW+ = myuser #rewrite history
- Commit and push to foo
git commit -am "Add XXX repo" git push origin master
Add user
- Ask the user to create an ssh key and to give the public key
ssh-keygen cat ~/.ssh/id_rsa.pub
- Create a new file for the key in keydir
echo 'ssh-rsa AAA[...]' > keydir/name@machine.pub git add keydir/name@machine.pub git commit -am "new key for name" git push origin master
Tip
If you don't want to specify the port every time you use ssh/git, you can add the host to your ~/.ssh/config:
Host git.fixme.ch
Port 1337
Deploy
- There is a git hook to publish most of the application in production.
- The deploy hook is located at
/home/git/hooks/deploy.shin the Internal_Server. - You must add a
post-receivehook in your project in a file/home/git/repositories/yourproject/hooks/post-receivewith the following content:
DIR=/path/to/project #example: /var/www/foo/htdocs APP=user-to-chown-to #example: www-data /home/git/hooks/deploy.sh $APP $DIR
- Permissions fix for the hooks and repo
chmod +x /home/git/repositories/yourproject/hooks/post-receive
chown gitolite:gitolite /home/git/repositories/yourproject/hooks/post-receive
chown -R gitolite:$APP /path/to/project
find /path/to/project -type f -exec chmod 640 {} \;
find /path/to/project -type d -exec chmod 750 {} \;
- It's also a good thing to have a check of the database when you launch the application, and automatically create it if it doesn't yet exist.
How to use git ?
If you come from svn, forget all that you have learnt, and start from scratch. A good start would be to do the http://git-scm.com/ tutorial. Some good ressources to learn git includes:
- http://ftp.newartisans.com/pub/git.from.bottom.up.pdf
- http://eagain.net/articles/git-for-computer-scientists/