2009-09-15 08:34:15 +02:00
|
|
|
# "push to admin" in gitolite
|
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
**WARNING: THIS DOCUMENT IS OBSOLETE. DO NOT USE. IT IS RETAINED ONLY FOR
|
|
|
|
HISTORICAL PURPOSES**. Gitolite now does "push-to-admin" by default, and does
|
|
|
|
it very easily and simply by front-loading the ssh problem. See the install
|
|
|
|
doc for details.
|
|
|
|
|
2009-09-15 08:34:15 +02:00
|
|
|
----
|
|
|
|
|
|
|
|
Gitosis's default mode of admin is by cloning and pushing the `gitosis-admin`
|
|
|
|
repo. I call this "push to admin". It's a very cool/cute feature, and I
|
|
|
|
loved it at first.
|
|
|
|
|
|
|
|
But it's a ***support nightmare***. Half the gitosis angst on `#git` is
|
|
|
|
because of this feature. Gitolite does not use or endorse this method for
|
|
|
|
people new to git, or ssh or (worse) both.
|
|
|
|
|
|
|
|
However, ***if*** you know git and ssh really, *really*, well and you know
|
|
|
|
what you're doing, this is a pretty nice thing to have -- does make life
|
2009-09-20 17:55:16 +02:00
|
|
|
easier, I admit. So, here is how to make PTA (hey nice acronym, just missing
|
|
|
|
an "I") work on gitolite as well.
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-09-20 17:55:16 +02:00
|
|
|
Note:
|
|
|
|
|
|
|
|
* unlike the rest of gitolite, I can't help you with this unless you
|
|
|
|
convince me very quickly it's not a layer 8 problem :-)
|
|
|
|
|
|
|
|
* here's a test to see if you should use this feature: after reading this
|
|
|
|
document, think about how you would switch back and forth between the
|
|
|
|
normal method and push-to-admin. If you can't immediately see what you
|
|
|
|
would need to do, please don't use it :-)
|
2009-09-15 08:34:15 +02:00
|
|
|
|
|
|
|
The instructions are presented as shell commands; they should be fairly
|
|
|
|
obvious. All paths are from the default `~/.gitolite.rc`; if you changed any,
|
|
|
|
make the same changes below.
|
|
|
|
|
2009-09-20 17:55:16 +02:00
|
|
|
----
|
2009-09-16 06:46:11 +02:00
|
|
|
|
|
|
|
> **WARNING**: the "compilation" runs via a `post-update` hook. Which, by
|
|
|
|
> definition, runs *after* the push has successfully completed. As a
|
|
|
|
> result, a *compilation error* will be visible to the admin doing the `git
|
|
|
|
> push` but will not otherwise look like an error to client-side git (in
|
|
|
|
> terms of return codes, scripting, etc., or even the "git gui" if you
|
|
|
|
> happen to use that for pushing). So be sure to watch out for compile
|
|
|
|
> error messages on push when you do this.
|
|
|
|
|
2009-09-15 08:34:15 +02:00
|
|
|
----
|
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
#### server side setup
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
1. First, on the server, log on to the `git` userid, add a new repo called
|
|
|
|
`gitolite-admin` to the config file, give yourself `RW` or `RW+` rights to it,
|
|
|
|
and "compile":
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
cd ~/.gitolite
|
|
|
|
vim conf/gitolite.conf # add gitolite-admin repo, etc
|
|
|
|
src/gl-compile-conf
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
2. Now, if you look at the "compile" script, it has an *automatic* local commit
|
|
|
|
inside, just for safety, which kicks in every time you compile. This only
|
|
|
|
works if it finds a ".git" directory, and it was designed as an "automatic
|
|
|
|
backup/safety net" type of thing, in case I accidentally deleted the whole
|
|
|
|
config file or something.
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
We need to disable this, because now we have a *better* repo, one that is
|
|
|
|
manually pushed, and presumably has proper commit messages!
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
mv .git .disable.git # yeah it's a hack, sue me
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
3. Now the compile command created an empty, bare, "gitolite-admin" repo, so we
|
|
|
|
seed it with the current contents of the config and keys. (A note on the
|
|
|
|
`GIT_WORK_TREE` variable: I avoid setting these variables in the normal way
|
|
|
|
because I always forget to unset them later, and then when I `cd` to other
|
|
|
|
repos they play havoc with my git commands, so this is how I do it)
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
cd ~/repositories/gitolite-admin.git
|
2009-10-23 06:53:06 +02:00
|
|
|
GIT_WORK_TREE=$HOME/.gitolite git add conf/gitolite.conf keydir
|
|
|
|
GIT_WORK_TREE=$HOME/.gitolite git commit -am start
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
4. Now we have to setup the post-update hook for push-to-admin to work. The hook
|
|
|
|
should (1) make a forced checkout in the "live" config directory (which is
|
|
|
|
`~/.gitolite`), and (2) run the compile script.
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
`src/pta-hook.sh` has the code you need; just copy it to the right place with
|
|
|
|
the right name, change the first line if needed, and make it executable:
|
|
|
|
|
|
|
|
# (assuming pwd is still ~/repositories/gitolite-admin.git)
|
|
|
|
cp ~/.gitolite/src/pta-hook.sh hooks/post-update
|
|
|
|
|
|
|
|
# if you changed $GL_ADMINDIR in ~/.gitolite.conf, then edit the hooks
|
|
|
|
# and change the first line:
|
|
|
|
vim hooks/post-update
|
|
|
|
|
|
|
|
chmod +x hooks/post-update
|
2009-09-15 08:34:15 +02:00
|
|
|
|
|
|
|
----
|
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
#### client side setup
|
|
|
|
|
|
|
|
1. Now get to your workstation, and
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
git clone git@server:gitolite-admin.git
|
2009-09-15 08:34:15 +02:00
|
|
|
|
2009-10-04 05:55:20 +02:00
|
|
|
That's it, we're done. You're in gitosis land as far as this is concerned
|
|
|
|
now. So knock yourself out. Or lock yourself out... :-)
|