The mob account (the name a tribute to the paper Mob Software: The Erotic Life of Code) is.a way to enable anonymous push access for your project. This is largely an experiment and may be scrapped in the future if it will not get widespread use, but we think it's an interesting try. The idea is to provide unmoderated side channel for random contributors to work on a project, with similar rationale as e.g. Wikipedia - that given enough interested people, the quality will grow rapidly and occassional "vandalism" will get fixed quickly. Of course this may not work nearly as well for software, but here we are, to give it a try.

For Repository Admins

How it works? First, you need to add the mob user to the list of users allowed to push in your project. mob is a keyless, passwordless user that anyone can use to push, without any special setup. But this does not mean that your project is now in the hands of raging mindless mob! The mob user has a special restriction: it can push only to an existing mob branch. This means that the second step you need to take is to create a mob branch in the repository (e.g. git checkout -b mob && git push origin mob). Then the mob user will be able to push to this and only this branch, and it won't be able to push whatsoever until you take the second step.

To sum it up: Anonymous pushes are allowed only to the mob branch and only if you add a mob user and do an initial pushout of the mob branch.

For Users

After cloning the repository, do git checkout mob to move to the mob branch.

Note that you are taking a huge security risk on yourself if you just blindly grab the mob branch and run it on your system.

For Developers

Just commit on the mob branch you've checked out and git push when the time is ripe. Have fun and enjoy, you are making the history!

Personal Mob Branches

If the mob user has push permission to a project, but your user does not, then you may push to a personal mob area. You must Register user in order to use the personal mob area.

This personal mob area is kept under refs/mob/mob.username and refs/mob/mob_username/ and coexists independently with the single global mob branch. The refs in the personal mob area need not be created first to be used and may also be freely deleted by the user.

Also note that changes to any refs in the personal mob area will not generate any email notifications.

There are two possible ways to use the personal mob area:

  1. A single ref like mob.username or
  2. Multiple refs located under mob_username/

As a convenience to personal mob ref users who do not also have general push permission for a project, pushes to refs/heads/mob.username and refs/heads/mob_username/* are automatically mapped to the corresponding refs/mob/mob... location which makes it somewhat easier to push branches to the personal mob area.

More details and examples may be found below here and here.

In Detail Examples

Pushing to the global mob branch with ssh

Nothing special is needed except to remember to set the mob user name in the push url:

cd /tmp
git clone -b mob git://dev.repo.or.cz:8418/mobexample.git
cd mobexample
git remote set-url --push origin ssh://mob@dev.repo.or.cz:24/mobexample.git
echo 'It worked!' >> example.txt
git add example.txt
git commit -m 'example commit'
git push origin mob

Note that it’s not strictly necessary to fetch with the git protocol, the ssh protocol can also be used for fetching.

Pushing to the global mob branch with https

In order to push with https, several things will be needed first:

  1. The mob user certificate

    This can be fetched from here and will be assumed to be saved to /tmp/devrorcz_mob_user.pem in the push example.

    cd /tmp && curl -O https://dev.repo.or.cz/devrorcz_mob_user.pem
    
  2. The mob user private key

    This can be fetched from here and will be assumed to be saved to /tmp/devrorcz_mob_key.pem in the push example. Normally, of course, private keys are never shared, but as described above, since everyone is allowed to push to the mob branch the private key for the mob user must be shared with everyone.

    cd /tmp && curl -O https://dev.repo.or.cz/devrorcz_mob_key.pem
    

With the prerequisites out of the way, here’s the mob ssh example redone to use the smart http protocol:

cd /tmp
git clone -b mob https://dev.repo.or.cz/mobexample.git
cd mobexample
git config http.sslCert /tmp/devrorcz_mob_user.pem
git config http.sslKey /tmp/devrorcz_mob_key.pem
git remote set-url --push origin https://dev.repo.or.cz/mobexample.git
echo 'It worked!' >> example.txt
git add example.txt
git commit -m 'example commit'
git push origin mob

If using git version 1.8.5 or later, the http.sslCert and http.sslKey values can be set just once in the Git global configuration file so they apply only to a specific URL (such as https://dev.repo.or.cz).

Note that it’s not strictly necessary to fetch with the http protocol, the https protocol can also be used for fetching. However, if using a version of Git older than version 1.8.5, it can be a bother to get the two certificates and the key set properly without a project-specific place to configure them yet (this is not a problem with Git version 1.8.5 or later). See the output of git config help for more information about configuring certificates and keys.

Pushing to the personal mob area

Pushing should be configured as though your user had push permission to the project.

Any supported push URL may be used.

Here’s a mob.$user example using the ssh protocol:

# assume that $HOME/.ssh/config has been set up to automatically provide
# the ssh key for user alice when pushing to example.com

git clone ssh://example.com/someproject.git
cd someproject

# this is the single personal mob ref technique
git checkout -b mob.alice
git push -u origin mob.alice

It’s just that simple.

Here’s a mob_$user/... ref example using the https protocol:

# assume that git config http.sslCert and http.sslKey have been properly
# set up to provide the user authentication certificate for user bob
# when pushing to example.com

git clone https://example.com/someproject.git
cd someproject

# this is the multiple personal mob ref technique
git checkout -b mob_bob/master
git push -u origin mob_bob/master

# additional refs may be pushed to mob_bob/...

Of course the ssh protocol can be used with the multiple ref technique and the https protocol can be used with the single ref technique.

Cloning the personal mob area

Since the personal mob area is intentionally sequestered under refs/mob/ a little extra work is needed to clone from a personal mob ref to start with.

This example will clone both user alice and user bob’s personal mob areas, merge them and then push them to user eve’s personal mob area.

# assume that $HOME/.ssh/config has been set up to automatically provide
# the ssh key for user eve when pushing to example.com
git clone -n ssh://example.com/someproject.git
cd someproject

# optionally we may first check which personal mob refs are available
git ls-remote origin | grep 'refs/mob/'
# we can see from the output that alice has a mob.alice branch and
# and bob has a mob_bob/master branch.

# since nothing under refs/mob is normally fetched we must add instructions
# to fetch the personal mob area of both alice and bob being careful to
# match the refs we need
git config --add remote.origin.fetch '+refs/mob/mob.alice:refs/remotes/origin/mob.alice'
git config --add remote.origin.fetch '+refs/mob/mob_bob/*:refs/remotes/origin/mob_bob/*'

# alternatively, this mapping will just get every personal mob ref
# but this is not really recommended
#git config --add remote.origin.fetch '+refs/mob/*:refs/remotes/origin/*'

# now fetch the new refs
git fetch

# merge mob.alice and mob_bob/master and push to mob.eve
git checkout mob.alice
git checkout mob_bob/master
git checkout -b mob.eve
git merge mob.alice
git push -u origin mob.eve

Not so difficult, but a little bit of extra work to clone from a personal mob area.

Of course a mirror clone would get everything under refs/mob/ but that would not be helpful since it would also be bare.

(view source)