Project

General

Profile

RedmineRepositories » History » Version 24

Alex Bevilacqua, 2009-10-27 17:43
Updated link for GIT

1 1 Jean-Philippe Lang
h1. Repositories
2
3 19 Mischa The Evil
{{>toc}}
4 1 Jean-Philippe Lang
5 19 Mischa The Evil
h2. General information
6 1 Jean-Philippe Lang
7 24 Alex Bevilacqua
Redmine natively supports integration with different SCM-tools: "Subversion":http://subversion.tigris.org/, "CVS":http://www.nongnu.org/cvs/, "Mercurial":http://www.selenic.com/mercurial/, "Darcs":http://darcs.net/, "Git":http://git-scm.com, and "Bazaar":http://bazaar-vcs.org/.
8 19 Mischa The Evil
9
Note that you need to install the appropriate binaries on your Redmine host and make sure that these binaries are available in the @PATH@ environment variable:
10
11 9 Jean-Philippe Lang
|*SCM*|*Tested with*|*Comments*|
12 17 Jean-Philippe Lang
|Subversion|1.3 & 1.4 & 1.5 & 1.6|1.3 or higher required|
13 9 Jean-Philippe Lang
|CVS|1.12.12|1.12 required, won't work with CVSNT|
14
|Mercurial|0.9.3| |
15 16 Jean-Philippe Lang
|Bazaar|1.0.0.candidate.1| |
16 1 Jean-Philippe Lang
|Darcs|1.0.7||
17 16 Jean-Philippe Lang
|Git|1.5.4.2||
18 9 Jean-Philippe Lang
19 19 Mischa The Evil
For example, if you want to access Subversion repositories in Redmine, you'll have to install the svn binaries on the Redmine host. Redmine currently doesn't make use of the Ruby Bindings for Subversion.
20 1 Jean-Philippe Lang
21
h2. Attaching an existing repository to a project
22
23
In the project settings, make sure that the 'Repository' module is enabled and go to the 'Repository' tab.
24
Select the SCM that corresponds to your repository and enter the path or URL of your repository.
25
26
*Important*: When you first browse the repository, Redmine retrieves the description of all of the existing commits and stores them in the database.
27
This is done only once per repository but can very long (or even time out) if your repository has hundreds of commits.
28
29
To avoid this, you can do it offline.
30
After having your repository declared in Redmine, run the following command:
31 19 Mischa The Evil
<pre>
32
$ ruby script/runner "Repository.fetch_changesets" -e production
33
</pre>
34 1 Jean-Philippe Lang
35
All commits will be retrieved in the Redmine database.
36
37
h3. Subversion repository
38
39 19 Mischa The Evil
The usual protocols are supported (eg. @http:@, @svn:@, @file:@), just enter the URL of the repository.
40 1 Jean-Philippe Lang
41 19 Mischa The Evil
For example:
42 1 Jean-Philippe Lang
<pre>
43
http://host/path/to/the/repository
44
</pre>
45
46 5 Jean-Philippe Lang
You can specify a username and password if the repository requires authentication.
47
48 1 Jean-Philippe Lang
Note: if you want to access the repository using @svn+ssh://@, you'll have to configure svn+ssh to be non-interactive.
49
This requires to setup a public/private key pair for ssh authentication.
50
51
h3. CVS repository
52
53
Enter:
54
* the URL of the repository (it can be either a path or a connection string, eg. @:pserver@).
55
* the module name
56 15 Azamat Hackimov
57 19 Mischa The Evil
For example:
58
<pre>
59
:pserver:login:password@host:/path/to/the/repository
60
</pre>
61 10 Thomas Lecavelier
62 19 Mischa The Evil
h3. Git repository
63 1 Jean-Philippe Lang
64 19 Mischa The Evil
h4. Local environment setup
65 10 Thomas Lecavelier
66 19 Mischa The Evil
Redmine requires a *bare* and *local* repository to enable browsing through Redmine.
67
68 21 Mischa The Evil
Imagine you want to browse the to-do list manager project "Donebox": its clone URL is @git://github.com/ook/donebox.git@.
69 19 Mischa The Evil
On the server where you're running Redmine, create a directory accessible by the user running your Redmine server:
70 10 Thomas Lecavelier
<pre>
71
$ sudo mkdir -p /var/redmine/git_repositories
72
$ sudo chown rails:rails /var/redmine/git_repositories
73
$ cd /var/redmine/git_repositories
74
</pre>
75
76 19 Mischa The Evil
Note the second line: it changes the ownership of the newly created directory to the user @rails@ and the group @rails@. Of course, you have to replace it according to your server settings (it can be @www-data@, @apache@ or when you are having a very bad sysadmin: @root@). Keep in mind that this user needs to have the (local-)permissions to run the @git@ command.
77 1 Jean-Philippe Lang
78 19 Mischa The Evil
h4. Create the bare repository
79
80
After the preceding steps have been taken it is time to create our bare repository:
81 1 Jean-Philippe Lang
<pre>
82
$ pwd
83
/var/redmine/git_repositories
84
$ git clone --bare git://github.com/ook/donebox.git
85
Initialized empty Git repository in /var/redmine/git_repositories/donebox/
86
remote: Counting objects: 401, done.
87
remote: Compressing objects: 100% (246/246), done.
88
remote: Total 401 (delta 134), reused 401 (delta 134)
89
Receiving objects: 100% (401/401), 179.55 KiB | 185 KiB/s, done.
90 10 Thomas Lecavelier
Resolving deltas: 100% (134/134), done.
91
</pre>
92
93 20 Mischa The Evil
Our bare repository is now created successfully! Now go to your Redmine project settings, go to the repositories tab and choose @git@ as the SCM, then put in the "Path to .git directory" (in our example this is @/var/redmine/git_repositories/donebox/@) and save the settings. Have a look at your repository tab: you should now be able to browse your repository successfully.
94 10 Thomas Lecavelier
95 19 Mischa The Evil
Note: of course, this git repository won't update by itself. You'll have to @git pull@ it regulary by hand or set up a cron job which will execute the @git pull@-command automatically for you.
96
97 22 Babar O'Cap
h4. Bare repository on Windows
98
99
If your bare repository is install on *Windows*, adding :
100
<pre>;%GIT_PATH%\cmd;%GIT_PATH%\bin;</pre> to your %%PATH%% environment variable.
101
Where %%GIT_PATH%% is the install directory of Git (eg: _C:/Git_)
102
103 19 Mischa The Evil
h3. Mercurial repository
104
105 23 Yannick Warnier
To synchronize with a Mercurial repository, you will have to have a local clone of the repository on the same server you have Redmine installed on. Let's say you put Redmine in /var/www/redmine.example.com/www and have put your mercurial repository in /var/www/sources.example.com/repo/example, you would have to select *Mercurial* as a SCM, then enter */var/www/sources.example.com/repo/example* in the repository text box.
106
107
This will start checking out the Mercurial repository, and you won't see the results straight away. Wait for a few seconds (or possibly minutes), and click the *Repository* tab of your project (not of your configuration settings). You should now see the results appear.
108 19 Mischa The Evil
109
h3. Bazaar repository
110
111
TBD
112
113 1 Jean-Philippe Lang
h3. Darcs repository
114 21 Mischa The Evil
115
TBD
116
117
h2. Repository user-mapping
118 19 Mischa The Evil
119
TBD