[OSM-dev] I converted the rails port to Git

Ævar Arnfjörð Bjarmason avarab at gmail.com
Mon Feb 22 00:46:58 GMT 2010


On Mon, Feb 22, 2010 at 00:09, Tom Hughes <tom at compton.nu> wrote:
> On 21/02/10 22:30, Ęvar Arnfjörš Bjarmason wrote:
>
>> We were discussing maybe moving over to Git in #osm and I thought I'd
>> do a quick conversion just to show how easy it is:
>>
>>     http://github.com/avar/openstreetmap-website
>>
>> Here are the commands you need to execute to convert it yourself:
>>
>>
>> http://wiki.github.com/avar/openstreetmap-website/subversion-to-git-commands
>
> Whilst I'm prepared to consider moving to git we need to give serious
> consideration to whether we want to host on an external site, if only from
> the point of view of maintaining a solid set of backups.

Yes, of course. Backups need to be done wherever this ends up.

>> Is anyone maintaining a file with the E-Mail addresses of commiters?
>> Tom?
>
> I don't have that as such, but if you can give me a list of usernames I
> should be able to come up with a list of addresses.

Just for the rails port this is everyone who's ever commited to it as
produced by:

    git log --pretty=format:%an | sort | uniq -c | sort -nr
    http://paste.scsys.co.uk/39613

>> We discussed briefly on IRC where we would host our Git repositories
>> if we hypothetically converted all of the OpenStreetMap SVN to
>> it. Personally I think Github would be great for that, the alternative
>> of just setting up our own git ssh:// and gitweb really misses the
>> added benefit of the web-based forking, pull requests,
>> multi-repostiory tracking and the other collaborative aspects of git
>> which really shine through with Github.
>
> Well apparently we can setup our own github if we want, but I will need to
> look at that.

It's possible to set up your own ssh:// or git:// server and a Gitweb
installation. Github however provides a lot more on top of that,
mainly having to do with the <buzzword>social</buzzword> aspects of
coding. I.e. it's really easy for anyone to fork your repository and
easy for you to monitor what they're doing and merge stuff back if you
want.

Check out for example this network graph for the recently released
hiphop-php: http://github.com/facebook/hiphop-php/network

You can drag it & see that people have been passing patches around and
merging back and forth as they need some features that other people
have added.

A better example perhaps is rails-i18n which gets a lot of merge
requests, and it's something we use:

    http://github.com/svenfuchs/rails-i18n/network

All of this is possible without using something like Github of course
but it's much harder (set up your own hosting instead of just clicking
"fork") and it's not as easy to see what's being added to your code
elsewhere & to merge those changes back.

>> Some people on IRC were worried about the case where Github might be
>> down and they wanted to deploy the site. It is down every once in a
>> while but in those cases it should be just a matter of doing:
>>
>>     git push ssh://deploy.openstreetmap.org/repos/web.git master
>>
>>  From your local machine which also has those changes, and of course it
>> would also be trivial to automatically replicate Github's repositories
>> somewhere else as commits come in due to the distributed nature of
>> Git.
>
> What is deploy.openstreetmap.org exactly? In order to make deployment work
> we need somewhere we can pull from to multiple machines.

A hypothetical local mirror of the "official" repository used for
deployment. Just like the webserver (presumably) has a Subversion
checkout now.

>> In the very worst case of it getting nuked from orbit by invading
>> aliens you'll just copy the ssh keys you've allowed to somewhere else
>> and tell commiters to do:
>>
>>     git config remote.origin.url
>> git://aliens-ate-github.org/openstreetmap/web.git
>
> That presumes that aliens-ate-github.org has somehow magically gained a copy
> of the code from github before the aliens arrived.

No. In this case you'd do:

     # Doesn't work, aliens ate github
    git pull

    # Go to http://aliens-ate-github.org and create a fresh empty
repository, then:
    git config remote.origin.url
git://aliens-ate-github.org/openstreetmap/web.git

    # Populate it with your local copy
    git push

Since every Git repository is a full cryptographically signed copy of
the full repository history everyone working on the code has a full
backup up to the time that he or she last did "git pull".

Of course you want a more reliable backup than just counting on
commiters to have a recent copy. It's easy to do this by setting up a
cronjob somewhere that does "git pull" from github to a local copy
somewhere every hour or so, that's how I backup my repositories on
Github.




More information about the dev mailing list