Moxie
2015-11-23 67834872ddd5630b9c30c53c2972f5dcbf3dd5aa
commit | author | age
48fe87 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
M 2 <html>
3 <head>
4 <!-- Begin Header -->
5 <title>Gitblit</title>
6 <meta charset="utf-8">
7 <meta name="ROBOTS" content="INDEX">
8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9 <meta name="viewport" content="width=device-width, initial-scale=1.0">
10         
11 <link rel="stylesheet" href="./bootstrap/css/bootstrap.css">
12 <link rel='shortcut icon' type='image/png' href='./gitblt-favicon.png' />
13 <link rel="stylesheet" href="./prettify/prettify.css" />
14 <!-- Google Plus Profile Page -->
15 <link rel="publisher" href="https://plus.google.com/114464678392593421684" />
16 <style type="text/css"> a.gpluspage { margin-top:3px;text-decoration: none; } </style>
17
18 <!-- Google Plus One -->
19 <link rel="canonical" href="http://gitblit.com" />
20 <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
21 <style type="text/css"> div.gplusone { margin-top:12px; } </style>
22
23 <script src="./prettify/prettify.js"></script>
24 <script src="./bootstrap/js/jquery.js"></script>
25 <script src="./bootstrap/js/bootstrap.min.js"></script>
26 </head>
27 <body onload='prettyPrint()'>        <!-- Navigation Bar -->
28         <div class="navbar navbar-fixed-top">
29             <div class="navbar-inner">
30                 <div class="container">
31                       <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
32                         <span class="icon-bar"></span>
33                         <span class="icon-bar"></span>
34                         <span class="icon-bar"></span>
35                       </a>
36                       <a class="brand" href="./"><img src="./gitblt_25_white.png" alt="Gitblit"></img></a>
37                     <div class="nav-collapse">
38                         <ul class="nav">
39                             <li class='dropdown'> <!-- Menu -->
40 <a class='dropdown-toggle' href='#' data-toggle='dropdown'>about<b class='caret'></b></a>
41 <ul class='dropdown-menu'>
42 <li><a href='index.html'>overview</a></li>
43 <li><a href='features.html'>features</a></li>
44 <li><a href='screenshots.html'>screenshots</a></li>
45 </ul></li> <!-- End Menu -->
46 <li class='dropdown'> <!-- Menu -->
47 <a class='dropdown-toggle' href='#' data-toggle='dropdown'>documentation<b class='caret'></b></a>
48 <ul class='dropdown-menu'>
49 <li class='dropdown-submenu'> <!-- Submenu -->
50 <a tabindex='-1' href='#'>Gitblit GO</a>
51 <ul class='dropdown-menu'>
52 <li><a href='setup_go.html'>setup GO</a></li>
53 <li><a href='upgrade_go.html'>upgrade GO</a></li>
54 </ul></li> <!-- End Submenu -->
55 <li class='divider'></li>
56 <li class='dropdown-submenu'> <!-- Submenu -->
57 <a tabindex='-1' href='#'>Gitblit WAR</a>
58 <ul class='dropdown-menu'>
59 <li><a href='setup_war.html'>setup WAR</a></li>
60 <li><a href='upgrade_war.html'>upgrade WAR</a></li>
61 </ul></li> <!-- End Submenu -->
62 <li class='divider'></li>
63 <li class='dropdown-submenu'> <!-- Submenu -->
64 <a tabindex='-1' href='#'>Server Configuration</a>
65 <ul class='dropdown-menu'>
66 <li><a href='administration.html'>administration</a></li>
67 <li><a href='setup_authentication.html'>authentication</a></li>
68 <li><a href='setup_hooks.html'>push hooks</a></li>
69 <li><a href='setup_lucene.html'>lucene indexing</a></li>
70 <li><a href='setup_proxy.html'>reverse proxies</a></li>
71 <li><a href='setup_clientmenus.html'>client app menus</a></li>
72 <li><a href='setup_bugtraq.html'>bugtraq</a></li>
73 <li><a href='setup_mirrors.html'>mirrors</a></li>
74 <li><a href='setup_scaling.html'>scaling</a></li>
5287d2 75 <li><a href='setup_fail2ban.html'>fail2ban</a></li>
48fe87 76 <li class='divider'></li>
M 77 <li><a href='setup_viewer.html'>Gitblit as a viewer</a></li>
78 </ul></li> <!-- End Submenu -->
79 <li class='divider'></li>
80 <li class='dropdown-submenu'> <!-- Submenu -->
81 <a tabindex='-1' href='#'>Client Usage</a>
82 <ul class='dropdown-menu'>
83 <li><a href='setup_transport_http.html'>using HTTP/HTTPS</a></li>
84 <li><a href='setup_transport_ssh.html'>using SSH</a></li>
85 <li><a href='eclipse_plugin.html'>using the Eclipse plugin</a></li>
86 </ul></li> <!-- End Submenu -->
87 <li class='divider'></li>
88 <li class='dropdown-submenu'> <!-- Submenu -->
89 <a tabindex='-1' href='#'>Tickets</a>
90 <ul class='dropdown-menu'>
91 <li><a href='tickets_overview.html'>overview</a></li>
92 <li><a href='tickets_using.html'>using</a></li>
93 <li><a href='tickets_barnum.html'>barnum</a></li>
94 <li><a href='tickets_setup.html'>setup</a></li>
95 <li><a href='tickets_replication.html'>replication & advanced administration</a></li>
96 </ul></li> <!-- End Submenu -->
97 <li class='divider'></li>
98 <li class='dropdown-submenu'> <!-- Submenu -->
99 <a tabindex='-1' href='#'>Plugins</a>
100 <ul class='dropdown-menu'>
101 <li><a href='plugins_overview.html'>overview</a></li>
102 <li><a href='plugins_extensions.html'>extension points</a></li>
103 </ul></li> <!-- End Submenu -->
104 <li class='divider'></li>
105 <li><a href='federation.html'>federation</a></li>
106 <li class='divider'></li>
107 <li><a href='properties.html'>settings</a></li>
108 <li><a href='faq.html'>faq</a></li>
109 <li class='divider'></li>
110 <li><a href='design.html'>design</a></li>
111 <li><a href='rpc.html'>rpc</a></li>
112 </ul></li> <!-- End Menu -->
113 <li class='dropdown'> <!-- Menu -->
114 <a class='dropdown-toggle' href='#' data-toggle='dropdown'>releases<b class='caret'></b></a>
115 <ul class='dropdown-menu'>
116 <li><a href='releasenotes.html'>release notes</a></li>
117 <li><a href='releases.html'>release history</a></li>
118 </ul></li> <!-- End Menu -->
119 <li class='dropdown'> <!-- Menu -->
120 <a class='dropdown-toggle' href='#' data-toggle='dropdown'>downloads<b class='caret'></b></a>
121 <ul class='dropdown-menu'>
678348 122 <li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.zip'>Gitblit GO (Windows)</a></li>
M 123 <li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.tar.gz'>Gitblit GO (Linux/OSX)</a></li>
124 <li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.war'>Gitblit WAR</a></li>
48fe87 125 <li class='divider'></li>
M 126 <li><a href='https://registry.hub.docker.com/u/jmoger/gitblit/'>Gitblit GO (Docker)</a></li>
127 <li class='divider'></li>
128 <li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li>
129 <li class='divider'></li>
678348 130 <li><a href='http://dl.bintray.com/gitblit/releases/manager-1.7.1.zip'>Gitblit Manager</a></li>
M 131 <li><a href='http://dl.bintray.com/gitblit/releases/fedclient-1.7.1.zip'>Federation Client</a></li>
48fe87 132 <li class='divider'></li>
678348 133 <li><a href='http://dl.bintray.com/gitblit/releases/gbapi-1.7.1.zip'>API Library</a></li>
48fe87 134 <li class='divider'></li>
M 135 <li><a href='https://bintray.com/gitblit/releases/gitblit'>Bintray (1.4.0+)</a></li>
136 <li><a href='https://code.google.com/p/gitblit/downloads/list?can=1'>GoogleCode (pre-1.4.0)</a></li>
137 <li class='divider'></li>
138 <li><a href='http://gitblit.github.io/gitblit-maven'>Maven Repository</a></li>
139 </ul></li> <!-- End Menu -->
140 <li class='dropdown'> <!-- Menu -->
141 <a class='dropdown-toggle' href='#' data-toggle='dropdown'>links<b class='caret'></b></a>
142 <ul class='dropdown-menu'>
143 <li><a href='https://dev.gitblit.com'>dev.gitblit.com (self-hosted)</a></li>
144 <li class='divider'></li>
145 <li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li>
146 <li class='divider'></li>
147 <li><a href='https://github.com/gitblit/gitblit'>Github</a></li>
5287d2 148 <li><a href='https://github.com/gitblit/gitblit'>Issues</a></li>
48fe87 149 <li><a href='http://groups.google.com/group/gitblit'>Discussion</a></li>
M 150 <li><a href='https://twitter.com/gitblit'>Twitter</a></li>
151 <li><a href='http://www.ohloh.net/p/gitblit'>Ohloh</a></li>
584328 152 <li class='divider'></li>
M 153 <li><a href='https://vimeo.com/86164723'>Gitblit Tickets screencast</a></li>
154 <li><a href='https://asciinema.org/a/9342'>Gitblit SSH and Plugin Management asciicast</a></li>
155 <li><a href='http://episodes.gitminutes.com/2014/05/gitminutes-29-james-moger-on-gitblit.html'>GitMinutes #29: James Moger on Gitblit</a></li>
48fe87 156 <li class='divider'></li>
M 157 <li><a href='https://twitter.com/JamesMoger'>@JamesMoger</a></li>
158 </ul></li> <!-- End Menu -->
159 <li class='divider-vertical'></li>
160 <li><a href='https://plus.google.com/114464678392593421684?prsrc=3' class='gpluspage'><img src='https://ssl.gstatic.com/images/icons/gplus-16.png' width='16' height='16 style='order: 0;'/></a></li><li><div class='gplusone'><g:plusone size='small' href='http://gitblit.com'></g:plusone></div></li>
161                         </ul>
162                     </div><!--/.nav-collapse -->
163                 </div>
164             </div>
165         </div><!-- end Navigation Bar -->
166 <div class='container'>
167 <!-- Begin Markdown -->
168 <h2 class="section" id='H1'><a href="#H1" class="sectionlink"><i class="icon-share-alt"> </i></a>Federating Gitblit</h2><p><em>SINCE 0.6.0</em></p><p>A Gitblit federation is a mechanism to clone repositories and keep them in sync from one Gitblit instance to another. Federation can be used to maintain a mirror of your Gitblit instance, to aggregate repositories from developer workstations, or to initially clone groups of repositories to developer workstations. If you are/were a Subversion user you might think of this as <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html">svn-sync</a>, but better.</p><p>If your Gitblit instance allows federation and it is properly registered with another Gitblit instance, each of the <em>non-excluded</em> repositories of your Gitblit instance can be mirrored, in their entirety, to the pulling Gitblit instance. You may optionally allow pulling of user accounts and backup of server settings.</p><p>The federation feature should be considered a security backdoor and enabled or disabled as appropriate for your installation.<br/><br/>Please review all the documentation to understand how it works and its limitations.</p><p><img src="fed_aggregation.png"  alt="block diagram"/></p>
169 <h3 class="section" id='H2'><a href="#H2" class="sectionlink"><i class="icon-share-alt"> </i></a>Important Changes to Note</h3><p>The <em>Gitblit 0.8.0</em> federation protocol adds retrieval of teams and referenced push scripts. Older clients will not know to request team or push script information. </p><p>The <em>Gitblit 0.7.0</em> federation protocol is incompatible with the 0.6.0 federation protocol because of a change in the way timestamps are formatted.</p><p>Gitblit 0.6.0 uses the default <a href="http://google-gson.googlecode.com">google-gson</a> timestamp serializer which generates locally formatted timestamps. Unfortunately, this creates problems for distributed repositories and distributed developers. Gitblit 0.7.0 corrects this error by serializing dates to the <a href="http://en.wikipedia.org/wiki/ISO_8601">iso8601</a> standard. As a result 0.7.0 is not compatible with 0.6.0. A partial backwards-compatibility fallback was considered but it would only work one direction and since the federation mechanism is bidirectional it was not implemented.</p>
170 <h3 class="section" id='H3'><a href="#H3" class="sectionlink"><i class="icon-share-alt"> </i></a>Origin Gitblit Instance Requirements</h3>
171 <ul>
172   <li><em>git.enableGitServlet</em> must be true, all Git clone and pull requests are handled through Gitblit's JGit servlet</li>
173   <li><em>federation.passphrase</em> must be non-empty</li>
174   <li>The Gitblit origin instance must be http/https accessible by the pulling Gitblit instance.<br/>That may require configuring port-forwarding on your router and/or opening ports on your firewall.</li>
175 </ul>
176 <h4 class="section" id='H4'><a href="#H4" class="sectionlink"><i class="icon-share-alt"> </i></a>federation.passphrase</h4><p>The passphrase is used to generate permission tokens that can be shared with other Gitblit instances.</p><p>The passphrase value never needs to be shared, although if you give another Gitblit instance the <em>ALL</em> federation token then your passphrase will be transferred/backed-up along with all other server settings.</p><p>This value can be anything you want: an integer, a sentence, an haiku, etc. You should probably keep the passphrase simple and use standard Latin characters to prevent Java properties file encoding errors. The tokens generated from this value are affected by case, so consider this value CASE-SENSITIVE.</p><p>The federation feature is completely disabled if your passphrase value is empty.</p><p><strong>NOTE</strong>:<br/>Changing your <em>federation.passphrase</em> will break any registrations you have established with other Gitblit instances.</p>
177 <h3 class="section" id='H5'><a href="#H5" class="sectionlink"><i class="icon-share-alt"> </i></a>Pulling Gitblit Instance Requirements</h3>
178 <ul>
179   <li>consider setting <em>federation.allowProposals=true</em> to facilitate the registration process from origin Gitblit instances</li>
180   <li>properly registered Gitblit instance including, at a minimum, url, <em>federation token</em>, and update frequency</li>
181 </ul>
182 <h3 class="section" id='H6'><a href="#H6" class="sectionlink"><i class="icon-share-alt"> </i></a>Controlling What Gets Pulled</h3><p>If you want your repositories (and optionally users accounts and settings) to be pulled by another Gitblit instance, you need to register your origin Gitblit instance with a pulling Gitblit instance by providing the url of your Gitblit instance and a federation token.</p><p>Gitblit generates the following standard federation tokens:</p><p><pre>String allToken = SHA1(passphrase + &quot;-ALL&quot;);
183 String usersAndRepositoriesToken = SHA1(passphrase + &quot;-USERS_AND_REPOSITORIES&quot;);
184 String repositoriesToken = SHA1(passphrase + &quot;-REPOSITORIES&quot;);
185 </pre></p><p>The <em>ALL</em> token allows another Gitblit instance to pull all your repositories, user accounts, server settings, and referenced push scripts.<br/>The <em>USERS_AND_REPOSITORIES</em> token allows another Gitblit instance to pull all your repositories and user accounts.<br/>The <em>REPOSITORIES</em> token only allows pulling of the repositories.</p><p>Individual Gitblit repository configurations such as <em>description</em> and <em>accessRestriction</em> are always mirrored.</p><p>If <em>federation.passphrase</em> has a non-empty value, the federation tokens are displayed in the log file and are visible, to administrators, in the web ui.</p><p>The three standard tokens grant access to ALL your non-excluded repositories. However, if you only want to specify different groups of repositories to be federated then you need to define <em>federation sets</em>. </p>
186 <h4 class="section" id='H7'><a href="#H7" class="sectionlink"><i class="icon-share-alt"> </i></a>Federation Sets</h4><p>Federation Sets (*federation.sets*) are named groups of repositories. The Federation Sets are defined in <code>gitblit.properties</code> and are available for selection in the repository settings page. You can assign a repository to one or more sets and then distribute the federation token for the set. This allows you to grant federation pull access to a subset of your available repositories. Tokens for federation sets only grant pull access for the member repositories.</p>
187 <h3 class="section" id='H8'><a href="#H8" class="sectionlink"><i class="icon-share-alt"> </i></a>Federation Proposals (Origin Gitblit Instance)</h3><p>Once you have properly setup your passphrase and can see your federation tokens, you are ready to share them with a pulling Gitblit instance.</p><p>The registration process can be partially automated by sending a <em>federation proposal</em> to the pulling Gitblit instance.<br/>To send a proposal:</p>
188 <ol>
189   <li>Login to your Gitblit instance as an administrator</li>
190   <li>Select and click the <em>propose</em> link for the appropriate token on the <em>federation</em> page</li>
191   <li>Confirm the publicly accessible url of your (origin) Gitblit instance</li>
192   <li>Enter the url of the pulling Gitblit instance you want to federate with</li>
193   <li>Optionally enter a message for the administrators</li>
194   <li>Click <em>propose</em></li>
195 </ol><p>Not all Gitblit instances accept <em>federation proposals</em>, there is a setting which allows Gitblit to outright reject them. In this case an email or instant message to the administrator of the other Gitblit instance is required. :)</p><p>If your proposal is accepted, the proposal is cached to disk on the pulling Gitblit server and, if properly configured, the administrators of that Gitblit server will receive an email notification of your proposal.</p><p>Your proposal includes:</p>
196 <ol>
197   <li>the url of your Gitblit instance</li>
198   <li>the federation token you selected and its type</li>
199   <li>the list of your <em>non-excluded</em> repositories, and their configuration details, that you propose to share</li>
200 </ol><p>Submitting a proposal does not automatically register your server with the pulling Gitblit instance.<br/>Registration is a manual process for an administrator.</p>
201 <h3 class="section" id='H9'><a href="#H9" class="sectionlink"><i class="icon-share-alt"> </i></a>Federation Proposals (Pulling Gitblit Instance)</h3><p>If your Giblit instance has received a <em>federation proposal</em>, you will be alerted to that information the next time you login to Gitblit as an administrator.</p><p>You may view the details of a proposal by scrolling down to the bottom of the repositories page and selecting a proposal. Sample registration settings will be generated for you that you may copy &amp; paste into either your <code>gitblit.properties</code> file or your <code>web.xml</code> file.</p>
202 <h3 class="section" id='H10'><a href="#H10" class="sectionlink"><i class="icon-share-alt"> </i></a>Excluding Repositories (Origin Gitblit Instance)</h3><p>You may exclude a repository from being pulled by any federated Gitblit instance by setting its <em>federation strategy</em> to EXCLUDE in the repository's settings page.</p>
203 <h3 class="section" id='H11'><a href="#H11" class="sectionlink"><i class="icon-share-alt"> </i></a>Excluding Repositories (Pulling Gitblit Instance)</h3><p>You may exclude repositories to pull in a federation registration. You may exclude all or you may exclude based on a simple fuzzy pattern. Only one wildcard character may be used within each pattern. Patterns are space-separated within the exclude and include fields. </p>
204 <pre><code>federation.example.exclude = skipit.git
205 </code></pre><p><strong>OR</strong></p>
206 <pre><code>federation.example.exclude = *
207 federation.example.include = somerepo.git someotherrepo.git
208 </code></pre><p><strong>OR</strong></p>
209 <pre><code>federation.example.exclude = *
210 federation.example.include = common/* library/*
211 </code></pre>
212 <h3 class="section" id='H12'><a href="#H12" class="sectionlink"><i class="icon-share-alt"> </i></a>Tracking Status (Pulling Gitblit Instance)</h3><p>Below the repositories list on the repositories page you will find a section named <em>federation registrations</em>. This section enumerates the other gitblit servers you have configured to periodically pull. The <em>status</em> of the latest pull will be indicated on the left with a colored circle, similar to the status of an executed unit test or Hudson/Jenkins build. You can drill into the details of the registration to view the status of the last pull from each repository available from that origin Gitblit instance. Additionally, you can specify the <em>federation.N.notifyOnError=true</em> flag, to be alerted via email of regressive status changes to individual registrations.</p>
213 <h3 class="section" id='H13'><a href="#H13" class="sectionlink"><i class="icon-share-alt"> </i></a>Tracking Status (Origin Gitblit Instance)</h3><p>Origin Gitblit instances can not directly track the success or failure status of Pulling Gitblit instances. However, the Pulling Gitblit instance may elect to send a status acknowledgment (*federation.N.sendStatus=true*) to the origin Gitblit server that indicates the per-repository status of the pull operation. This is the same data that is displayed on the Pulling Gitblit instances ui.</p>
214 <h3 class="section" id='H14'><a href="#H14" class="sectionlink"><i class="icon-share-alt"> </i></a>How does it work? (Origin Gitblit Instances)</h3><p>A pulling Gitblit instance will periodically contact your Gitblit instance and will provide the token as proof that you have granted it federation access. Your Gitblit instance will decide, based on the supplied token, if the requested data should be returned to the pulling Gitblit instance. Gitblit data (user accounts, repository metadata, and server settings) are serialized as <a href="http://json.org">JSON</a> using <a href="http://google-gson.googlecode.com">google-gson</a> and returned to the pulling Gitblit instance. Standard Git clone and pull operations are used to transfer commits.</p><p>The federation process executes using an internal administrator account, <em>$gitblit</em>. All the normal authentication and authorization processes are used for federation requests. For example, Git commands are authenticated as <em>$gitblit / token</em>.</p><p>While the <em>$gitblit</em> account has access to all repositories, server settings, and user accounts, it is prohibited from accessing the web ui and it is disabled if <em>federation.passphrase</em> is empty.</p>
215 <h3 class="section" id='H15'><a href="#H15" class="sectionlink"><i class="icon-share-alt"> </i></a>How does it work? (Pulling Gitblit Instances)</h3><p>Federated repositories defined in <code>gitblit.properties</code> are checked after Gitblit has been running for 1 minute. The next registration check is scheduled at the completion of the current registration check based on the registration's specified frequency.</p>
216 <ul>
217   <li>The shortest frequency allowed is every 5 minutes</li>
218   <li>Decimal frequency values are cast to integers</li>
219   <li>Frequency values may be specified in mins, hours, or days</li>
220   <li>Values that can not be parsed default to 60 minutes</li>
221 </ul><p>After a repository has been cloned it is flagged as <em>isFederated</em> (which identifies it as being sourced from another Gitblit instance), <em>isFrozen</em> (which prevents Git pushes to this mirror) and <em>federationStrategy=EXCLUDED</em> (which prevents this repository from being pulled by another federated Gitblit instance).</p>
222 <h4 class="section" id='H16'><a href="#H16" class="sectionlink"><i class="icon-share-alt"> </i></a>Origin Verification</h4><p>During a federated pull operation, Gitblit does check that the <em>origin</em> of the local repository starts with the url of the federation registration.<br/>If they do not match, the repository is skipped and this is indicated in the log.</p>
223 <h4 class="section" id='H17'><a href="#H17" class="sectionlink"><i class="icon-share-alt"> </i></a>User Accounts & Teams</h4><p>By default all user accounts and teams (except the <em>admin</em> account) are automatically pulled when using the <em>ALL</em> token or the <em>USERS_AND_REPOSITORIES</em> token. You may exclude a user account from being pulled by a federated Gitblit instance by checking <em>exclude from federation</em> in the edit user page.</p><p>The pulling Gitblit instance will store a registration-specific <code>users.conf</code> file for the pulled user accounts and their repository permissions. This file is stored in the <em>federation.N.folder</em> folder.</p><p>If you specify <em>federation.N.mergeAccounts=true</em>, then the user accounts and team definitions from the origin Gitblit instance will be integrated into the <code>users.conf</code> file of your Gitblit instance and allow sign-on of those users.</p><p><strong>NOTE:</strong><br/>Upgrades from older Gitblit versions will not have the <em>#notfederated</em> role assigned to the <em>admin</em> account. Without that role, your admin account WILL be transferred with an <em>ALL</em> or <em>USERS_AND_REPOSITORIES</em> token.<br/>Please consider adding the <em>#notfederated</em> role to your admin account!</p>
224 <h4 class="section" id='H18'><a href="#H18" class="sectionlink"><i class="icon-share-alt"> </i></a>Server Settings</h4><p>Server settings are only pulled when using the <em>ALL</em> token.</p><p>The pulling Gitblit instance will store a registration-specific <code>gitblit.properties</code> file for all pulled settings. This file is stored in the <em>federation.N.folder</em> folder.</p><p>These settings are unused by the pulling Gitblit instance.</p>
225 <h4 class="section" id='H19'><a href="#H19" class="sectionlink"><i class="icon-share-alt"> </i></a>Push Scripts</h4><p>Your Groovy push scripts are only pulled when using the <em>ALL</em> token.</p><p>The pulling Gitblit instance will retrieve any referenced (i.e. used) push script and store it locally as <em>registration_scriptName.groovy</em> in the <em>federation.N.folder</em> folder.</p><p>These scripts are unused by the pulling Gitblit instance.</p>
226 <h3 class="section" id='H20'><a href="#H20" class="sectionlink"><i class="icon-share-alt"> </i></a>Collisions and Conflict Resolution</h3><p>Gitblit does <strong>not</strong> detect conflict and it does <strong>not</strong> offer conflict resolution of repositories, users, teams, or settings.</p><p>If an object exists locally that has the same name as the remote object, it is assumed they are the same and the contents of the remote object are merged into the local object. If you can not guarantee that this is the case, then you should not store any federated repositories directly in <em>git.repositoriesFolder</em> and you should not enable <em>mergeAccounts</em>.</p><p>By default, federated repositories can not be pushed to, they are read-only by the <em>isFrozen</em> flag. This flag is <strong>ONLY</strong> enforced by Gitblit's JGit servlet. If you push to a federated repository after resetting the <em>isFrozen</em> flag or via some other Git access technique then you may break Gitblit's ability to continue pulling from the origin repository. If you are only pushing to a local branch then you might be safe.</p>
227 <h2 class="section" id='H21'><a href="#H21" class="sectionlink"><i class="icon-share-alt"> </i></a>Federation Pull Registration Keys</h2>
228 <table class="table">
229 <tr><th>federation.N.url</th>
230 <td>string</td>
231 <td>the url of the origin Gitblit instance <em>(required)</em></td>
232 </tr>
233
234 <tr><th>federation.N.token</th>
235 <td>string</td>
236 <td>the token provided by the origin Gitblit instance <em>(required)</em></td>
237 </tr>
238
239 <tr><th>federation.N.frequency</th>
240 <td>x [mins/hours/days]</td>
241 <td>the period to wait between pull executions</td>
242 </tr>
243
244 <tr><th>federation.N.folder</th>
245 <td>string</td>
246 <td>the destination folder, relative to <em>git.repositoriesFolder</em>, for these repositories.<br/>default is <em>git.repositoriesFolder</em></td>
247 </tr>
248
249 <tr><th>federation.N.bare</th>
250 <td>boolean</td>
251 <td>if <b>true</b> <em>(default)</em>, each repository is cloned as a bare repository (i.e. no working folder).</td>
252 </tr>
253
254 <tr><th>federation.N.mirror</th>
255 <td>boolean</td>
256 <td>if <b>true</b> <em>(default)</em>, each repository HEAD is reset to <em>origin/master</em> after each pull.  The repository is flagged <em>isFrozen</em> after the initial clone.<br/><br/>If <b>false</b>, each repository HEAD will point to the FETCH_HEAD of the initial clone from the origin until pushed to or otherwise manipulated.</td>
257 </tr>
258
259 <tr><th>federation.N.mergeAccounts</th>
260 <td>boolean</td>
261 <td>if <b>true</b>, merge the retrieved accounts into the <code>users.conf</code> of <b>this</b> Gitblit instance.<br/><em>default is false</em></td>
262 </tr>
263
264 <tr><th>federation.N.sendStatus</th>
265 <td>boolean</td>
266 <td>if <b>true</b>, send the status of the federated pull to the origin Gitblit instance.<br/><em>default is false</em></td>
267 </tr>
268
269 <tr><th>federation.N.include</th>
270 <td>string array<br/>(space-delimited)</td>
271 <td>list of included repositories <em>(wildcard and fuzzy matching supported)</em></td>
272 </tr>
273
274 <tr><th>federation.N.exclude</th>
275 <td>string array<br/>(space-delimited)</td>
276 <td>list of excluded repositories <em>(wildcard and fuzzy matching supported)</em></td>
277 </tr>
278
279 <tr><th>federation.N.notifyOnError</th>
280 <td>boolean</td>
281 <td>if <b>true</b>, send an email to the administrators on an error.<br/><em>default is false</em></td>
282 </tr>
283 </table>
284 <h2 class="section" id='H22'><a href="#H22" class="sectionlink"><i class="icon-share-alt"> </i></a>Example Federation Pull Registrations</h2><p>These examples would be entered into the <code>gitblit.properties</code> file of the pulling gitblit instance.</p>
285 <h4 class="section" id='H23'><a href="#H23" class="sectionlink"><i class="icon-share-alt"> </i></a>(Nearly) Perfect Mirror Example</h4><p><img src="fed_mirror.png"  alt="block diagram"/></p><p>This assumes that the <em>token</em> is the <em>ALL</em> token from the origin gitblit instance.</p><p>The repositories, example1_users.conf, example1_gitblit.propertiesn and all example1_scripts.groovy will be put in <em>git.repositoriesFolder</em> and the origin user accounts will be merged into the local user accounts, including passwords and all roles. The Gitblit instance will also send a status acknowledgment to the origin Gitblit instance at the end of the pull operation. The status report will include the state of each repository pull (EXCLUDED, SKIPPED, NOCHANGE, PULLED, MIRRORED). This way the origin Gitblit instance can monitor the health of its mirrors.</p><p>This example is considered <em>nearly</em> perfect because while the origin Gitblit's server settings &amp; push scripts are pulled and saved locally, they are not merged with your server settings so its not a true mirror.</p>
286 <pre><code>federation.example1.url = https://go.gitblit.com
287 federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
288 federation.example1.frequency = 120 mins
289 federation.example1.folder =
290 federation.example1.bare = true 
291 federation.example1.mirror = true
292 federation.example1.mergeAccounts = true
293 federation.example1.sendStatus = true
294 </code></pre>
295 <h4 class="section" id='H24'><a href="#H24" class="sectionlink"><i class="icon-share-alt"> </i></a>Just Repositories Example</h4><p>This assumes that the <em>token</em> is the <em>REPOSITORIES</em> token from the origin gitblit instance.<br/>The repositories will be put in <em>git.repositoriesFolder</em>/example2.</p>
296 <pre><code>federation.example2.url = https://tomcat.gitblit.com/gitblit
297 federation.example2.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
298 federation.example2.frequency = 120 mins
299 federation.example2.folder = example2
300 federation.example2.bare = true
301 federation.example2.mirror = true
302 </code></pre>
303 <h4 class="section" id='H25'><a href="#H25" class="sectionlink"><i class="icon-share-alt"> </i></a>All-but-One Repository Example</h4><p>This assumes that the <em>token</em> is the <em>REPOSITORIES</em> token from the origin gitblit instance.<br/>The repositories will be put in <em>git.repositoriesFolder</em>/example3.</p>
304 <pre><code>federation.example3.url = https://tomcat.gitblit.com/gitblit
305 federation.example3.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
306 federation.example3.frequency = 120 mins
307 federation.example3.folder = example3
308 federation.example3.bare = true
309 federation.example3.mirror = true
310 federation.example3.exclude = somerepo.git
311 </code></pre>
312 <h4 class="section" id='H26'><a href="#H26" class="sectionlink"><i class="icon-share-alt"> </i></a>Just One Repository Example</h4><p>This assumes that the <em>token</em> is the <em>REPOSITORIES</em> token from the origin gitblit instance.<br/>The repositories will be put in <em>git.repositoriesFolder</em>/example4.</p>
313 <pre><code>federation.example4.url = https://tomcat.gitblit.com/gitblit
314 federation.example4.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
315 federation.example4.frequency = 120 mins
316 federation.example4.folder = example4
317 federation.example4.bare = true
318 federation.example4.mirror = true
319 federation.example4.exclude = *
320 federation.example4.include = somerepo.git
321 </code></pre>
322 <h2 class="section" id='H27'><a href="#H27" class="sectionlink"><i class="icon-share-alt"> </i></a>Federation Client</h2><p>Instead of setting up a full-blown pulling Gitblit instance, you can also use the <a href="http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%">federation client</a> command-line utility. This is a packaged subset of the federation feature in a smaller, simpler command-line only tool.</p><p>The <em>federation client</em> relies on many of the same dependencies as Gitblit and will download them on first execution.</p>
323 <h3 class="section" id='H28'><a href="#H28" class="sectionlink"><i class="icon-share-alt"> </i></a>federation.properties</h3><p>You may use the <code>federation.properties</code> file to configure one or more Gitblit instances that you want to pull from. This file is a subset of the standard <code>gitblit.properties</code> file.</p><p>By default this tool does not daemonize itself; it executes and then quits. This allows you to use the native scheduling feature of your OS. Of course, if you'd rather use Gitblit's scheduler you may use that by specifying the <code>--daemon</code> parameter.</p>
324 <h3 class="section" id='H29'><a href="#H29" class="sectionlink"><i class="icon-share-alt"> </i></a>http.sslVerify</h3><p>If you are pulling from a Gitblit with a self-signed SSL certificate you will need to configure Git/JGit to bypass certificate verification.<br/>(<a href="http://www.kernel.org/pub/software/scm/git/docs/git-config.html">Git-Config Manual Page</a>) </p>
325 <pre>git config --global --bool --add http.sslVerify false</pre>
326 <h3 class="section" id='H30'><a href="#H30" class="sectionlink"><i class="icon-share-alt"> </i></a>Command-Line Parameters</h3><p>Instead of using <code>federation.properties</code> you may directly specify a Gitblit instance to pull from with command-line parameters.</p>
327 <pre><code>java -jar fedclient.jar --url https://go.gitblit.com --mirror --bare --token 123456789
328      --repositoriesFolder c:/mymirror
329
330 java -jar fedclient.jar --url https://go.gitblit.com --mirror --bare --token 123456789
331      --repositoriesFolder c:/mymirror --daemon --frequency &quot;24 hours&quot;
332 </code></pre>
333 <!-- End Markdown -->
678348 334 <footer class="footer"><p class="pull-right">generated 2015-11-23</p>
48fe87 335 <p>The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.</p>
M 336 </footer>
337 </div>
338 <!-- Google Analytics -->
339 <script type="text/javascript">
340     var _gaq = _gaq || [];
341     _gaq.push(['_setAccount', 'UA-24377072-1']);
342     _gaq.push(['_trackPageview']);
343
344     (function() {
345         var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
346         ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
347         var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
348     })();
349 </script>
350
351 </body>
352 </html>