Util.pm: add new parse_any_date function
[girocco.git] / html / mob.html
blob3ecdc70e8d49efa6356ac9374f479e219291577e
1 @section=site guide
2 @heading=About the Mob Account
3 @header
5 <!-- This file is preprocessed by cgi/html.cgi -->
8 <p>The <tt>mob</tt> account (the name a tribute to the paper
9 <a href="http://www.dreamsongs.com/MobSoftware.html">Mob Software: The Erotic Life of Code</a>)
10 is.a way to enable <em>anonymous push access</em> for your project.
11 This is largely an experiment and may be scrapped in the future if
12 it will not get widespread use, but we think it's an interesting try.
13 The idea is to provide unmoderated <em>side</em> channel for random
14 contributors to work on a project, with similar rationale as
15 e.g. Wikipedia - that given enough interested people, the quality
16 will grow rapidly and occassional "vandalism" will get fixed quickly.
17 Of course this may not work nearly as well for software, but here
18 we are, to give it a try.</p>
20 <h2>For Repository Admins</h2>
22 <p>How it works? First, you need to add the <tt>mob</tt> user to the
23 list of users allowed to push in your project. <tt>mob</tt> is a
24 keyless, passwordless user that anyone can use to push, without
25 any special setup. <strong>But</strong> this does not mean that
26 your project is now in the hands of raging mindless mob! The <tt>mob</tt>
27 user has a special restriction: it can push only to an existing
28 <tt>mob</tt> branch. This means that the second step you need to take
29 is to create a <tt>mob</tt> branch in the repository (e.g.
30 <code>git checkout -b mob
31 &amp;&amp; git push origin mob</code>). Then the <tt>mob</tt> user
32 will be able to push to this and only this branch, and it won't be
33 able to push whatsoever until you take the second step.</p>
35 <p>To sum it up: Anonymous pushes are allowed <em>only</em> to the <tt>mob</tt>
36 branch and <em>only</em> if you add a <tt>mob</tt> user and do an initial
37 pushout of the <tt>mob</tt> branch.</p>
39 <h2>For Users</h2>
41 <p>After cloning the repository, do <code>git checkout mob</code> to move to the
42 <tt>mob</tt> branch.</p>
44 <p><strong>Note that you are taking a huge security risk on yourself
45 if you just blindly grab the mob branch and run it on your
46 system.</strong></p>
48 <h2>For Developers</h2>
50 <p>Just commit on the <tt>mob</tt> branch you've checked out and
51 <code>git push</code> when the time is ripe.
52 Have fun and enjoy, you are making the history!</p>
54 <h2>Personal Mob Branches</h2>
56 <p>If the mob user has push permission to a project, but your user does not,
57 then you may push to a personal mob area. You must <a href="/reguser.cgi"
58 >Register user</a> in order to use the personal mob area.</p>
60 <p>This personal mob area is kept under <tt>refs/mob/mob.username</tt> and
61 <tt>refs/mob/mob_username/</tt> and coexists independently with the single
62 global mob branch. The refs in the personal mob area need not be created first
63 to be used and may also be freely deleted by the user.</p>
65 <p>Also note that changes to any refs in the personal mob area will not generate
66 any email notifications (but JSON/CIA notifications will still happen).</p>
68 <p>There are two possible ways to use the personal mob area:</p>
69 <ol>
70 <li>A single ref like <tt>mob.username</tt> or</li>
71 <li>Multiple refs located under <tt>mob_username/</tt>
72 </ol>
74 <p>As a convenience to personal mob ref users who do not also have general push
75 permission for a project, pushes to <tt>refs/heads/mob.username</tt> and
76 <tt>refs/heads/mob_username/*</tt> are automatically mapped to the corresponding
77 <tt>refs/mob/mob...</tt> location which makes it somewhat easier to push
78 branches to the personal mob area.</p>
80 <p>More details and examples may be found below <a href="#personalmob">here</a>
81 and <a href="#personalmobclone">here</a>.</p>
83 <h2>In Detail Examples</h2>
85 @@ifssh@@
86 <h3>Pushing to the global mob branch with ssh</h3>
88 <p>Nothing special is needed except to remember to set the mob user name in the push url:</p>
90 <blockquote><pre>
91 cd /tmp
92 git clone -b mob @@gitpullurl@@/mobexample.git
93 cd mobexample
94 git remote set-url --push origin @@mobpushurl@@/mobexample.git
95 echo 'It worked!' >> example.txt
96 git add example.txt
97 git commit -m 'example commit'
98 git push origin mob
99 </pre></blockquote>
101 <p>Note that it&#x2019;s not strictly necessary to fetch with the git protocol,
102 the ssh protocol can also be used for fetching.</p>
103 @@end@@
105 @@ifhttps@@
106 <h3 id="httpsmobpush">Pushing to the global mob branch with https</h3>
108 <p>In order to push with https, several things will be needed first:</p>
110 <ol>
111 <li>The @@nickname@@ root certificate
112 <p>This can be fetched from <a href="@@path(webadmurl)@@/@@nickname@@_root_cert.pem">here</a>
113 and will be assumed to be saved to <tt>/tmp/@@nickname@@_root_cert.pem</tt> in the push example.
114 See also the <a href="@@path(htmlurl)@@/rootcert.html">Root Certificate Information</a>.</p>
115 <pre>
116 cd /tmp &amp;&amp; curl -O @@gitwebfiles@@/@@nickname@@_root_cert.pem
117 </pre></li>
119 <li>The mob user certificate
120 <p>This can be fetched from <a href="@@path(webadmurl)@@/@@nickname@@_mob_user.pem">here</a>
121 and will be assumed to be saved to <tt>/tmp/@@nickname@@_mob_user.pem</tt> in the push example.</p>
122 <pre>
123 cd /tmp &amp;&amp; curl -O @@gitwebfiles@@/@@nickname@@_mob_user.pem
124 </pre></li>
126 <li>The mob user private key
127 <p>This can be fetched from <a href="@@path(webadmurl)@@/@@nickname@@_mob_key.pem">here</a>
128 and will be assumed to be saved to <tt>/tmp/@@nickname@@_mob_key.pem</tt> in the push example.
129 Normally, of course, private keys are never shared, but as described above, since everyone
130 is allowed to push to the mob branch the private key for the mob user must be shared with everyone.</p>
131 <pre>
132 cd /tmp &amp;&amp; curl -O @@gitwebfiles@@/@@nickname@@_mob_key.pem
133 </pre></li>
134 </ol>
136 <p>With the prerequisites out of the way, here&#x2019;s the mob ssh example
137 redone to use the smart http protocol:</p>
139 <blockquote><pre>
140 cd /tmp
141 git clone -b mob @@httppullurl@@/mobexample.git
142 cd mobexample
143 git config http.sslCAInfo /tmp/@@nickname@@_root_cert.pem
144 git config http.sslCert /tmp/@@nickname@@_mob_user.pem
145 git config http.sslKey /tmp/@@nickname@@_mob_key.pem
146 git remote set-url --push origin @@httpspushurl@@/mobexample.git
147 echo 'It worked!' >> example.txt
148 git add example.txt
149 git commit -m 'example commit'
150 git push origin mob
151 </pre></blockquote>
153 <p>Note that it&#x2019;s not strictly necessary to fetch with the http protocol,
154 the https protocol can also be used for fetching but when initially cloning the repository
155 it can be a bother to get the two certificates and the key set properly without a
156 project-specific place to configure them yet. See the output of <tt>git config help</tt> for
157 more information about configuring certificates and keys.</p>
158 @@end@@
160 <h3 id="personalmob">Pushing to the personal mob area</h3>
162 <p>Pushing should be configured as though your user had push permission to the project.</p>
164 <p>Any supported push URL may be used.</p>
166 <p>Here&#x2019;s a <tt>mob.$user</tt> example using the ssh protocol:</p>
168 <blockquote><pre>
169 # assume that ~/.ssh/config has been set up to automatically provide
170 # the ssh key for user alice when pushing to example.com
172 git clone ssh://example.com/someproject.git
173 cd someproject
175 # this is the single personal mob ref technique
176 git checkout -b mob.alice
177 git push -u origin mob.alice
178 </pre></blockquote>
180 <p>It&#x2019;s just that simple.</p>
182 <p>Here&#x2019;s a <tt>mob_$user/...</tt> ref example using the https protocol:</p>
184 <blockquote><pre>
185 # assume that git config http.sslCert and http.sslKey have been properly
186 # set up to provide the user authentication certificate for user bob
187 # when pushing to example.com
189 git clone https://example.com/someproject.git
190 cd someproject
192 # this is the multiple personal mob ref technique
193 git checkout -b mob_bob/master
194 git push -u origin mob_bob/master
196 # additional refs may be pushed to mob_bob/...
197 </pre></blockquote>
199 <p>Of course the ssh protocol can be used with the multiple ref technique and
200 the https protocol can be used with the single ref technique.</p>
202 <h3 id="personalmobclone">Cloning the personal mob area</h3>
204 <p>Since the personal mob area is intentionally sequestered under <tt>refs/mob/</tt>
205 a little extra work is needed to clone from a personal mob ref to start with.</p>
207 <p>This example will clone both user alice and user bob&#x2019;s personal mob
208 areas, merge them and then push them to user eve&#x2019;s personal mob area.</p>
210 <blockquote><pre>
211 # assume that ~/.ssh/config has been set up to automatically provide
212 # the ssh key for user eve when pushing to example.com
213 git clone -n ssh://example.com/someproject.git
214 cd someproject
216 # optionally we may first check which personal mob refs are available
217 git ls-remote origin | grep 'refs/mob/'
218 # we can see from the output that alice has a mob.alice branch and
219 # and bob has a mob_bob/master branch.
221 # since nothing under refs/mob is normally fetched we must add instructions
222 # to fetch the personal mob area of both alice and bob being careful to
223 # match the refs we need
224 git config --add remote.origin.fetch '+refs/mob/mob.alice:refs/remotes/origin/mob.alice'
225 git config --add remote.origin.fetch '+refs/mob/mob_bob/*:refs/remotes/origin/mob_bob/*'
227 # alternatively, this mapping will just get every personal mob ref
228 # but this is not really recommended
229 #git config --add remote.origin.fetch '+refs/mob/*:refs/remotes/origin/*'
231 # now fetch the new refs
232 git fetch
234 # merge mob.alice and mob_bob/master and push to mob.eve
235 git checkout mob.alice
236 git checkout mob_bob/master
237 git checkout -b mob.eve
238 git merge mob.alice
239 git push -u origin mob.eve
240 </pre></blockquote>
242 <p>Not so difficult, but a little bit of extra work to clone from a personal
243 mob area.</p>
245 <p>Of course a mirror clone would get everything under <tt>refs/mob/</tt> but that
246 would not be helpful since it would also be bare.</p>