Tuesday 7 December 2010

Developing on Windows, using Git, Dropbox and Ubuntu (and XAMPP)

I generally do my development work on Windows, mainly because a lot of it is .NET based. Occasionally I do non-.NET work (ruby/php), but since my main development pc is a Windows pc, I still usually use Windows.

Currently I have a client who uses Git for version control. Fair enough, I have TortoiseGit installed, so no problem, I thought. However we couldn't get the public/private key pair from my TortoiseGit/PuTTYgen to work with their Git server for authentication. I'm not sure why - something to do with the openssh keys being slightly different to the ones generated by PuTTYgen.

Since the client knows it works fine on Linux, it seemed to make sense to just go with Linux. But I still like to use my main development pc, which is a Windows pc.

Dropbox* to the rescue.

I have cloned the git repository into my Dropbox folder on my Linux pc. Dropbox syncs the files between my Linux and my Windows pc.

Now I can edit the files on my Windows pc and test them by running the Apache/MySQL/PHP based website on XAMPP. And while I'm doing the testing, Dropbox syncs my changes back to the cloned git repository on the Ubuntu pc.

It took a very long time to sync after the initial clone of the remote repository, and again after switching to the development branch, but after that it seems to work well.

TortoiseGit seems to be a bit confused with the synced git repository, so I'm not even going to try to actually use it for this project. Instead I'm using git on the command line on the Linux pc and that works fine.

A couple of points:


  • Sometimes there is a couple of seconds delay between saving files on Windows pc and appearing on the Linux pc, due to having to go through Dropbox, so it seems to be wise to wait a bit with git commands or at least check that the files have finished syncing.


  • Line endings. My editor saves with Windows style line endings by default, so I had to set it up to always save files with Unix style line endings (LF).


  • I have created symbolic links on Windows to link the git repository folder in the Dropbox folder into the htdocs folder in XAMPP (using mklink).
    mklink /D "moodle" "c:/users/me/my dropbox/git/moodle"
    The result is that I can now access the moodle site on http://localhost/moodle


  • I'm for now only working in one branch, and hope to keep it that way, as switching branches would possibly trigger another long sync time as it did the first time.



* If you don't have a Dropbox account, feel free to use this link to sign up and get a little bit of extra space. It will give me a bit of extra space as well.

No comments: