RedmineRepositories » History » Version 45
Mischa The Evil, 2011-11-13 00:04
[General information] Updated subversion compatibility for Subversion 1.7.x and changed to use new ASF homepage.
1 | 1 | Jean-Philippe Lang | h1. Repositories |
---|---|---|---|
2 | 1 | Jean-Philippe Lang | |
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 | 38 | Etienne Massip | Redmine natively supports integration with different SCM-tools: |
8 | 1 | Jean-Philippe Lang | |
9 | 38 | Etienne Massip | |*SCM*|*Supported versions*|*Comments*| |
10 | 45 | Mischa The Evil | |"Subversion":http://subversion.apache.org/|1.3, 1.4, 1.5, 1.6 & 1.7|1.3 or higher required. Doesn't support Ruby Bindings for Subversion. Subversion 1.7.0 and 1.7.1 contains bugs (#9541)| |
11 | 38 | Etienne Massip | |"CVS":http://www.nongnu.org/cvs/|1.12.12|1.12 required, won't work with CVSNT| |
12 | 44 | Mischa The Evil | |"Mercurial":http://www.selenic.com/mercurial/|1.2|1.6 or higher recommended (#9465)| |
13 | 38 | Etienne Massip | |"Bazaar":http://bazaar-vcs.org/|1.0.0.candidate.1 & 2.0.4| | |
14 | 38 | Etienne Massip | |"Darcs":http://darcs.net/|1.0.7|| |
15 | 38 | Etienne Massip | |"Git":http://git-scm.com|1.5.4.2|| |
16 | 1 | Jean-Philippe Lang | |
17 | 38 | Etienne Massip | +Note 1+ : the appropriate binaries *must* be installed on the *same host as Redmine*. |
18 | 9 | Jean-Philippe Lang | |
19 | 38 | Etienne Massip | For example, if you want to access Subversion repositories in Redmine, you'll have to install the svn binaries on the Redmine host. |
20 | 1 | Jean-Philippe Lang | |
21 | 38 | Etienne Massip | +Note 2+ : the appropriate binaries must be reachable by Redmine : |
22 | 38 | Etienne Massip | |
23 | 38 | Etienne Massip | 2 options : |
24 | 38 | Etienne Massip | * they are directly available in the @PATH@ environment variable: |
25 | 39 | Etienne Massip | ** if the command name is not the default one, you can redefine it in Redmine [[RedmineInstall#SCM-settings|configuration file]] |
26 | 39 | Etienne Massip | * you can define the full path to the binaries in Redmine [[RedmineInstall#SCM-settings|configuration file]] |
27 | 38 | Etienne Massip | |
28 | 38 | Etienne Massip | Finally, be sure to enable any SCM you wish to use globally in @Administration->Settings->Repositories->Enabled SCM@ |
29 | 1 | Jean-Philippe Lang | |
30 | 1 | Jean-Philippe Lang | h2. Attaching an existing repository to a project |
31 | 1 | Jean-Philippe Lang | |
32 | 1 | Jean-Philippe Lang | In the project settings, make sure that the 'Repository' module is enabled and go to the 'Repository' tab. |
33 | 34 | Graham King | Select the SCM that corresponds to your repository and enter the path or URL of your repository. |
34 | 1 | Jean-Philippe Lang | |
35 | 1 | Jean-Philippe Lang | *Important*: When you first browse the repository, Redmine retrieves the description of all of the existing commits and stores them in the database. |
36 | 1 | Jean-Philippe Lang | This is done only once per repository but can take a very long time (or even time out) if your repository has hundreds of commits. |
37 | 19 | Mischa The Evil | |
38 | 19 | Mischa The Evil | To avoid this, you can do it offline. |
39 | 19 | Mischa The Evil | After having your repository declared in Redmine, run the following command: |
40 | 1 | Jean-Philippe Lang | <pre> |
41 | 34 | Graham King | $ ruby script/runner "Repository.fetch_changesets" -e production |
42 | 1 | Jean-Philippe Lang | </pre> |
43 | 37 | Etienne Massip | |
44 | 1 | Jean-Philippe Lang | All commits will be retrieved in to the Redmine database. |
45 | 37 | Etienne Massip | |
46 | 37 | Etienne Massip | Since version 0.9.x, you can also call an URL via WS to execute @fetch_changesets@ : |
47 | 37 | Etienne Massip | |
48 | 37 | Etienne Massip | <pre> |
49 | 28 | Enderson Maia | http://redmine.example.com/sys/fetch_changesets?key=<WS key> (=> fetches changesets for all active projects) |
50 | 37 | Etienne Massip | http://redmine.example.com/sys/fetch_changesets?key=<WS key>&id=foo (=> fetches changesets for project foo only) |
51 | 37 | Etienne Massip | </pre> |
52 | 37 | Etienne Massip | |
53 | 28 | Enderson Maia | Don't forget to append @WS key@ authentication information as described in [[Rest_api#Authentication|Rest_api#Authentication]]. |
54 | 1 | Jean-Philippe Lang | |
55 | 1 | Jean-Philippe Lang | See [[HowTo_setup_automatic_refresh_of_repositories_in_Redmine_on_commit]] for an example. |
56 | 19 | Mischa The Evil | |
57 | 1 | Jean-Philippe Lang | h3. Subversion repository |
58 | 19 | Mischa The Evil | |
59 | 1 | Jean-Philippe Lang | The usual protocols are supported (eg. @http:@, @svn:@, @file:@), just enter the URL of the repository. |
60 | 1 | Jean-Philippe Lang | |
61 | 1 | Jean-Philippe Lang | For example: |
62 | 1 | Jean-Philippe Lang | <pre> |
63 | 5 | Jean-Philippe Lang | http://host/path/to/the/repository |
64 | 5 | Jean-Philippe Lang | </pre> |
65 | 1 | Jean-Philippe Lang | |
66 | 34 | Graham King | You can specify a username and password if the repository requires authentication. |
67 | 1 | Jean-Philippe Lang | |
68 | 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. |
69 | 1 | Jean-Philippe Lang | This requires you to setup a public/private key pair for ssh authentication. |
70 | 1 | Jean-Philippe Lang | |
71 | 1 | Jean-Philippe Lang | h3. CVS repository |
72 | 1 | Jean-Philippe Lang | |
73 | 15 | Azamat Hackimov | Enter: |
74 | 19 | Mischa The Evil | * the URL of the repository (it can be either a path or a connection string, eg. @:pserver@). |
75 | 19 | Mischa The Evil | * the module name |
76 | 19 | Mischa The Evil | |
77 | 19 | Mischa The Evil | For example: |
78 | 10 | Thomas Lecavelier | <pre> |
79 | 19 | Mischa The Evil | :pserver:login:password@host:/path/to/the/repository |
80 | 1 | Jean-Philippe Lang | </pre> |
81 | 19 | Mischa The Evil | |
82 | 10 | Thomas Lecavelier | h3. Git repository |
83 | 19 | Mischa The Evil | |
84 | 19 | Mischa The Evil | h4. Local environment setup |
85 | 21 | Mischa The Evil | |
86 | 40 | Tomas Pospisek | Redmine requires a repository which is *bare* and *local* to enable browsing through Redmine. |
87 | 10 | Thomas Lecavelier | |
88 | 10 | Thomas Lecavelier | Imagine you want to browse the to-do list manager project "Donebox": its clone URL is @git://github.com/ook/donebox.git@. |
89 | 10 | Thomas Lecavelier | On the server where you're running Redmine, create a directory accessible by the user running your Redmine server: |
90 | 10 | Thomas Lecavelier | <pre> |
91 | 10 | Thomas Lecavelier | $ sudo mkdir -p /var/redmine/git_repositories |
92 | 10 | Thomas Lecavelier | $ sudo chown rails:rails /var/redmine/git_repositories |
93 | 19 | Mischa The Evil | $ cd /var/redmine/git_repositories |
94 | 1 | Jean-Philippe Lang | </pre> |
95 | 19 | Mischa The Evil | |
96 | 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. |
97 | 19 | Mischa The Evil | |
98 | 1 | Jean-Philippe Lang | h4. Create the bare repository |
99 | 1 | Jean-Philippe Lang | |
100 | 1 | Jean-Philippe Lang | After the preceding steps have been taken it is time to create our bare repository: |
101 | 29 | Burt Culver | <pre> |
102 | 29 | Burt Culver | $ pwd |
103 | 1 | Jean-Philippe Lang | /var/redmine/git_repositories |
104 | 1 | Jean-Philippe Lang | $ git clone --bare git://github.com/ook/donebox.git donebox.git |
105 | 1 | Jean-Philippe Lang | Initialized empty Git repository in /var/redmine/git_repositories/donebox.git/ |
106 | 1 | Jean-Philippe Lang | remote: Counting objects: 401, done. |
107 | 1 | Jean-Philippe Lang | remote: Compressing objects: 100% (246/246), done. |
108 | 29 | Burt Culver | remote: Total 401 (delta 134), reused 401 (delta 134) |
109 | 29 | Burt Culver | Receiving objects: 100% (401/401), 179.55 KiB | 185 KiB/s, done. |
110 | 1 | Jean-Philippe Lang | Resolving deltas: 100% (134/134), done. |
111 | 10 | Thomas Lecavelier | $ cd donebox.git |
112 | 29 | Burt Culver | $ git remote add origin git://github.com/ook/donebox.git |
113 | 10 | Thomas Lecavelier | </pre> |
114 | 29 | Burt Culver | |
115 | 25 | Benoit Bénézech | 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.git/@) and save the settings. Have a look at your repository tab: you should now be able to browse your repository successfully. |
116 | 25 | Benoit Bénézech | |
117 | 25 | Benoit Bénézech | Note: of course, this git repository won't update by itself. You'll have to @git fetch@ it regulary by hand, set up a cron job which will execute the @git fetch@-command automatically for you or use a post-receive hook, like this one : |
118 | 31 | Stephen McGinty | |
119 | 1 | Jean-Philippe Lang | <pre> |
120 | 25 | Benoit Bénézech | echo "Post receive-hook => updating Redmine repository" |
121 | 31 | Stephen McGinty | sudo -u my_redmine_user -p secret perl -we '`cd /redmine/repositories/my_repo.git && git fetch && git reset --soft refs/remotes/origin/master`' |
122 | 29 | Burt Culver | </pre> |
123 | 29 | Burt Culver | |
124 | 19 | Mischa The Evil | Note the git reset, you'll *need it* to update the git tree and see your changes in the Repository view. The 'soft' option is required since it is a bare repository and the default option (mixed) will fail since there is no working tree. |
125 | 22 | Babar O'Cap | |
126 | 22 | Babar O'Cap | If you are using github, you can use the [[Plugin_List#Github-Hook-plugin|Github Hook Plugin]] |
127 | 22 | Babar O'Cap | |
128 | 22 | Babar O'Cap | h4. Bare repository on Windows |
129 | 22 | Babar O'Cap | |
130 | 22 | Babar O'Cap | If your bare repository is install on *Windows*, adding : |
131 | 33 | Beau Simensen | <pre>;%GIT_PATH%\cmd;%GIT_PATH%\bin;</pre> to your %%PATH%% environment variable. |
132 | 33 | Beau Simensen | Where %%GIT_PATH%% is the install directory of Git (eg: _C:/Git_) |
133 | 33 | Beau Simensen | |
134 | 33 | Beau Simensen | h4. Setting up a mirror repository (shortcut, tracking branches) |
135 | 33 | Beau Simensen | |
136 | 33 | Beau Simensen | The method above works fine under most circumstances but it can take a lot of tweaking to get certain things working if you have more than just a master branch. More information on the problem and the solution can be found on this "Stack Overflow question":http://stackoverflow.com/questions/4698649/how-do-i-get-a-remote-tracking-branch-to-stay-up-to-date-with-remote-origin-in-a. |
137 | 33 | Beau Simensen | |
138 | 33 | Beau Simensen | This method will help to keep branches from the repository's origin updated and visible in Redmine's repository browser. This is really only relevant if the local copy of the repository is only being used as a read-only copy specifically for Redmine's use. For example, the project is hosted on GitHub but Redmine is being used for issue tracking. |
139 | 33 | Beau Simensen | |
140 | 33 | Beau Simensen | <pre> |
141 | 33 | Beau Simensen | $ pwd |
142 | 33 | Beau Simensen | /var/redmine/git_repositories |
143 | 33 | Beau Simensen | $ git clone --mirror git://github.com/ook/donebox.git donebox.git |
144 | 33 | Beau Simensen | Initialized empty Git repository in /var/redmine/git_repositories/donebox.git/ |
145 | 33 | Beau Simensen | remote: Counting objects: 717, done. |
146 | 33 | Beau Simensen | remote: Compressing objects: 100% (561/561), done. |
147 | 33 | Beau Simensen | remote: Total 717 (delta 320), reused 371 (delta 134) |
148 | 33 | Beau Simensen | Receiving objects: 100% (717/717), 211.35 KiB | 86 KiB/s, done. |
149 | 33 | Beau Simensen | Resolving deltas: 100% (320/320), done. |
150 | 33 | Beau Simensen | $ cd donebox.git |
151 | 33 | Beau Simensen | $ git branch |
152 | 33 | Beau Simensen | WW |
153 | 33 | Beau Simensen | asap |
154 | 33 | Beau Simensen | bugcat |
155 | 33 | Beau Simensen | comeback |
156 | 33 | Beau Simensen | * master |
157 | 33 | Beau Simensen | </pre> |
158 | 33 | Beau Simensen | |
159 | 19 | Mischa The Evil | This method relies on the @--mirror@ option available for the git clone command. This option may not be available to older versions of git. In that case, please reference the "Stack Overflow question":http://stackoverflow.com/questions/4698649/how-do-i-get-a-remote-tracking-branch-to-stay-up-to-date-with-remote-origin-in-a for some ideas on how to setup this type of mirror functionality without using the @--mirror@ option. |
160 | 19 | Mischa The Evil | |
161 | 23 | Yannick Warnier | |
162 | 23 | Yannick Warnier | h3. Mercurial repository |
163 | 23 | Yannick Warnier | |
164 | 19 | Mischa The Evil | 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. |
165 | 19 | Mischa The Evil | |
166 | 19 | Mischa The Evil | 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. |
167 | 26 | David Muir | |
168 | 26 | David Muir | h3. Bazaar repository |
169 | 26 | David Muir | |
170 | 26 | David Muir | Put in the full path to your repository in "Root directory" |
171 | 26 | David Muir | i.e. /home/username/bzr/repo/trunk |
172 | 26 | David Muir | |
173 | 26 | David Muir | |
174 | 26 | David Muir | You'll need to make sure that bzr and bzrlib can be found in ENV['PATH'] and ENV['PYTHONPATH'] respectively. |
175 | 26 | David Muir | ie. edit config/environment.rb and add: |
176 | 26 | David Muir | |
177 | 26 | David Muir | <pre> |
178 | 19 | Mischa The Evil | ENV['PYTHONPATH'] = '/path/to/pythonlib' |
179 | 1 | Jean-Philippe Lang | ENV['PATH'] = "#{ENV['PATH']}:/path/to/bzr/bin" |
180 | 21 | Mischa The Evil | </pre> |
181 | 32 | Mischa The Evil | |
182 | 21 | Mischa The Evil | h3. Darcs repository |
183 | 21 | Mischa The Evil | |
184 | 19 | Mischa The Evil | TODO |
185 | 32 | Mischa The Evil | |
186 | 1 | Jean-Philippe Lang | h2. Repository user-mapping |
187 | 1 | Jean-Philippe Lang | |
188 | 41 | alan blount | In the project -> settings -> repository there is a link called users (on the lower right). |
189 | 41 | alan blount | |
190 | 41 | alan blount | That allows you to map users that have commits to the users in redmine. If the login name / email matches the mapping is automatic, otherwise you need to establish the map of repository users to redmine users. |
191 | 41 | alan blount | |
192 | 41 | alan blount | This is required for time tracking to work. |