Skip to content

Commit 487e907

Browse files
committed
Added more explicit instructions for configuring gitolite and generating
gitolite administrative key.
1 parent 3db41c5 commit 487e907

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

Diff for: README.mkd

+36-22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ to provide Git Smart HTTP access. Git repositories are automatically created wh
66
Redmine. There is also an option to automatically create a git repository for a project, when the project is created.
77
Caching functionality is also implemented to speed page-load times for viewing git repositories.
88

9+
Release Notes are available off the wiki: https://github.com/kubitron/redmine_git_hosting/wiki/Release-Notes.
10+
911
## Compatibility
1012

1113
The current version of this plugin is not compatible with all versions of Redmine and ChiliProject. As of this writing, it
@@ -23,11 +25,9 @@ problems that prevent administrative access (the plugin will exploit **gl-admin-
2325
## Configuration Strategy
2426

2527
One major problem when configuring ChiliProject/Redmine + Git is how the git repositories are accessed,
26-
and in particular setting permissions properly.
27-
This plugin solves this problem by allowing the web server/rails user to run git via sudo.
28-
A previous version of this plugin (see ssh branch) requires the configuration of git to run through ssh,
29-
but using sudo to allow the web server user to run commands as the git user is much faster.
30-
To configure your sudoers file to allow your web server user to run commands as git, and your git user
28+
and in particular setting permissions properly. This plugin solves this problem by allowing the web server/rails user to run git via sudo. A previous
29+
version of this plugin (see ssh branch) requires the configuration of git to run through ssh, but using sudo to allow the web server user to run commands
30+
as the git user is much faster. To configure your sudoers file to allow your web server user to run commands as git, and your git user
3131
to run commands as the web server user add these two lines to your sudoers file (run visudo to edit this file):
3232

3333
www-data ALL=(git) NOPASSWD:ALL
@@ -59,18 +59,28 @@ gitolite installation) is particularly useful for a web-hosting scenario with in
5959

6060
## Step-By-Step configuration instructions
6161

62-
**(1)** Install gitolite. The details of gitolite installation are beyond the scope of these instructions, and
63-
there are plenty of guides elsewhere on how to do this. For the purposes of this tutorial, we will assume
64-
that gitolite has been installed for user "git", and you have an ssh key called "git\_gitolite\_admin\_id\_rsa"
65-
(and corresponding public key) for which access to the gitolite-admin repository has been granted. The ssh
66-
key should not have a password set. *It is very important that this ssh key be unique and not used for anything
67-
other than administrative access, i.e. should not be used by any user as their access key.*
68-
69-
If possible, use gitolite version >= 2.0.3, so that the plugin will be able to recover from a
70-
variety of failures that mess up administrative access to the gitolite repository (the plugin will utilize **gl-admin-push**
62+
**(1)** Install gitolite. If possible, use gitolite version >= 2.0.3, so that the plugin will be able to
63+
recover from a variety of failures that mess up administrative access to the gitolite repository (the plugin will utilize **gl-admin-push**
7164
to fixup admin access in these circumstances). Note that the plugin will work with earlier versions of gitolite; however,
7265
it will not be able to recover from as many faults (it will attempt to use **gl-setup** which doesn't work quite as well).
7366

67+
The fine details of gitolite configuration are beyond the scope of these instructions, and there are plenty of guides elsewhere on configuration
68+
options. The following provides a simple (working) configuration. We will assume that gitolite has been installed for user "git" (adjust accordingly
69+
if gitolite has been installed with some other username). Generate an
70+
administrator key and initialize the gitolite repository in the following fashion as root:
71+
72+
su git
73+
ssh-keygen -N "" -f ~/.ssh/id_rsa
74+
gl-setup ~/.ssh/id_rsa.pub
75+
76+
Simply take any defaults offered by gl-setup (i.e. quit out of offered edit of the configuration file without making any changes). These commands
77+
will generate a new key in the .ssh directory of the "git" user, and use this key as the gitolite administrative key during the
78+
initialization of the gitolite repository.
79+
80+
You may choose to generate your administrative key in another way. However you generate your key, it is important that this key not have a passphrase
81+
set. *Further, it is very important that this ssh key be unique and not used for anything other than administrative access, i.e. should not be used by
82+
any user as their access key.*
83+
7484
**(2)** If you want to enable anonymous access to your repositories via the git:// protocol you will need to
7585
install the git-daemon. The details of this are beyond the scope of the tutorial as well (and again there
7686
are lots of available guides out there). This step is optional -- if you don't want to enable anonymous
@@ -89,17 +99,21 @@ lines below the original directive:
8999
Defaults:git !requiretty
90100
Defaults:www-data !requiretty
91101

102+
*Note: with at least some versions of Ubuntu, you must place any additions to the sudoers file at the end, otherwise the line starting with "admin ..." ends up
103+
negating these additions -- probably to your great frustration.*
104+
92105

93106
**(4)** In the root of your Redmine/ChiliProject rails directory -- the Redmine/ChiliProject root, not the plugin
94-
root, and not the public directory -- create a directory called .ssh, and copy the "gitolite_admin_id_rsa"
95-
private key and the "gitolite_admin_id_rsa.pub" files from step one into this directory. Then change the
96-
owner of these files to www-data and the permissions to 600 for the private key and 644 for the public key:
107+
root, and not the public directory -- create a directory called .ssh, and copy your gitolite administrative public/private
108+
key pair into this directory using "gitolite_admin_id_rsa" as the base name. Then change the owner of these files to www-data and
109+
the permissions to 600 for the private key and 644 for the public key. Assuming that you followed the key-generation step from (1) above,
110+
these instructions translate to performing the following as root:
97111

98112
cd REDMINE_ROOT
99113
mkdir .ssh
100-
cp [somewhere-or-other]/gitolite_admin_id_rsa .ssh/gitolite_admin_id_rsa
101-
cp [somewhere-or-other]/gitolite_admin_id_rsa.pub .ssh/gitolite_admin_id_rsa.pub
102-
114+
cp ~git/.ssh/id_rsa .ssh/gitolite_admin_id_rsa
115+
cp ~git/.ssh/id_rsa.pub .ssh/gitolite_admin_id_rsa.pub
116+
103117
chown www-data -R .ssh
104118
chmod 700 .ssh
105119
chmod 600 .ssh/gitolite_admin_id_rsa
@@ -109,8 +123,8 @@ owner of these files to www-data and the permissions to 600 for the private key
109123
**(5)** Clone the redmine_git_hosting plugin into the vendor/plugins subdirectory of your Redmine/ChiliProject
110124
root directory:
111125

112-
cd vendor/plugins
113-
git clone https://github.com/ericpaulbishop/redmine_git_hosting.git
126+
cd REDMINE_ROOT/vendor/plugins
127+
git clone https://github.com/kubitron/redmine_git_hosting.git
114128
rm -rf redmine_git_hosting/.git
115129
cd ../..
116130

0 commit comments

Comments
 (0)