Wednesday, 15 October 2014

Simple, secure way to share a git repository

The problem with Windows or NFS file shares is that the contents are not version-controlled and (unless you use the Windows "available off line" feature) not available while you're disconnected from the office network. However, it is very easy to set up a git repository for a team to share code and documents, if they all have at least intermittent access to the same file share.

First install yourself a git command-line client if you have not done so yet (see

Creating the repository

Assuming that
  • You already have a local git repository called "test-repo", which you want to share
  • Your local git repositories are under %HOMEDRIVE%\%HOMEPATH%\git
  • Your shared git repositories are going to be under \\myserver\myshare\git

To add a remote copy of your own git repository to the share:

>cd %HOMEPATH%\git\test-repo
>pushd "\\myserver\myshare\git"
>git init --bare test-repo.git
>git remote add origin "//myserver/myshare/git/test-repo.git"
>git push origin master

Note that the git commands require slashes to be forward - unlike normal Windows commands.

Verify that the file .git\config within your local git repository looks something like this:

    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    url = //myserver/myshare/git/test-repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
    rebase = true

Ensure that the sections [remote "origin"] and [branch "master"] in particular are set up correctly.

Cloning the repository

Another team member can now share your code - you both push your local commits to the shared repository and pull other team members' commits from it to your local repository. Here's what each team member wishing to access the shared repository should do, assuming that they also have their local git repositories under %HOMEDRIVE%\%HOMEPATH%\git.

>cd %HOMEPATH%\git
>git clone "//myserver/myshare/git/test-repo.git" test-repo
>cd test-repo
>git pull
>git status

The status should look like this:

# On branch master
nothing to commit (working directory clean)

Making cycling safer!

I have just been alerted to the existence of Collideoscope - a service that aims to collect data about cycling accidents and near misses directly from cyclists, and use it to press for improvements to road safety at accident black spots. What a brilliant idea. You can also use it to educate yourself about areas in which to take extra care when cycling.

Friday, 17 January 2014

Carbon - the EU's chance to shine

I am really concerned that we may be causing irreversible and harmful climate change.

While there is no conclusive proof that humankind is behind global warming, the evidence against us is stacking up more and more heavily.

The planet has some amazing mechanisms for keeping the environment stable, such as soaking CO2 up in the oceans, but these are not infinitely flexible and we may be approaching a tipping point. As an illustration of this, consider a glass filled with water and ice cubes, standing in a warm room. The ice/water mixture stays at 0 degrees as the ice gradually turns to water, but once all the ice has melted the temperature rapidly rises.

While we have not proved that our wasteful use of fossil energy is causing global warming, there is ample evidence that using a lot less won't cause any harm and may in fact stimulate the economy. So it would be logical to reduce our emissions of both greenhouse gases and waste heat as quickly as possible.

More research is needed to identify renewable energy sources that are much more efficient and less environmentally damaging than wind turbines or biofuels. Better insulation and more efficient heating, manufacturing, agriculture and transport are also needed.

Right now, the President of the EU Commission, Jose Manuel Barroso, is weighing a decision that could make or break our planet. His team have just days to pin down carbon emissions and renewable energy targets for Europe until 2030. It’s a very important deal that has been kept very quiet. Some EU countries, prompted by vested energy interests, are lobbying to set extremely unambitious targets. Barroso may opt to avoid a fight by playing it safe. He works in a bubble of politicians, officials and lobbyists, but he is very sensitive to what people think of him, especially now as he embarks on his last few months in the job and hopes to leave a shining legacy.

Avaaz is publishing an ad in the key Brussels paper today calling on Barroso to follow the science. If supported by tens of thousands of e-mail messages from across Europe, this could just jolt him out of the bubble. You can read the ad and send Barroso a message today that the the future of the world is in his hands.