Install Git On Your Ubuntu Desktop

I’ve been using Subversion for years. Git has been picking up a lot of steam. So, it’s time for a version control refresh. I’ve been playing around with Git the last three weeks. I love it. If you’re interested in learning Git, or just want Git installed on your Ubuntu desktop, this is an article for you. For weeks, I have been looking for a really easy way to install Git, but I haven’t seen one to my liking, until tonight when I found this website.

I found this Git package that is ready for all the latest Ubuntu releases. It’s available for Ubuntu 10.04 LTS, which I am using at the moment, and all the way to the latest release, version 11.04. All you have to do is add the repository to your software source. To install Git, open up your Terminal and type in the following commands:

Add Repository

sudo add-apt-repository ppa:pdoes/ppa/ubuntu

Update

sudo apt-get update

Install Git

sudo apt-get install git

If you’re new to Git, start learning by reading the Git Tutorial online. It’s excellent documentation by the way. So, there you have it. An easy way to install Git on your Ubuntu desktop.

WebDav and Ubuntu Encrypted Home Folder

I’ve been struggling in getting WedDav to work with my Subversion repository that’s installed on my home folder.  The problem lies with the way Ubuntu 9.10 encrypts the home folder. There seems to be no way around to the permission issues with WedDav. There are two things you can do: you can move your repository outside your home folder, or choose not to encrypt your home folder when installing Ubuntu. Anyways, encrypting your home folder is a nice feature, but it also brings some potential issues.

Install Subversion Repository on Ubuntu Desktop

This is a tutorial how to install a Subversion on your desktop. Subversion is an open-source revision control system. A repository is usually installed on servers so developers and programmers can have easy access to code. Subversion uses a check-in an check-out process for submitting changes to the repository. The repository can also be installed on desktop systems. Access is gained through many means by way of direct file access, ftp, http, svn and svn+ssh. See chart below.

Installing Subversion will install both Subversion administration tools and the client. In Ubuntu or Debian-based systems, you can install Subversion by performing the following commands. By the way, I added an Apache and Subversion WebDav module so both can be installed with just a single command.

Install Subversion

sudo apt-get install subversion libapache2-svn

Reboot the Apache Web Server

sudo /etc/init.d/apache2 restart

Create a Subversion Repository

svnadmin create /home/yourname/repository/

I’m placing the repository in my home directory. You can place it anywhere in your system. You may need to use sudo if you install it outside of your home directory. Remember the repository location, we will use it a few times below to configure the Apache Subversion WebDav module, etc.

Import your Repository

svn import /path/to/import/directory file:///home/yourname/repository

If you have a repository ready, now is a good time to import it. If you are just starting out, you can initialize the Repository here.

Access to Subversion

file:// Direct access on local disk
http:// Browser using http WebDav protocol
https:// Browser using https secure and WebDav
svn:// Subversion protocol
svn+ssh:// Subversion protocol and SSH tunnel

Configure WebDav protocol

sudo vi /etc/apache2/apache2.conf

Add

<Location /svn>
DAV svn
SVNPath /home/yourname/repository
AuthType Basic
AuthName "Repository"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>

Change Ownership to HTTP-User

sudo chown -R www-data:www-data /home/yourname/repository

Password Protect the Repository

sudo htpasswd -c /etc/subversion/passwd username

You will be asked to provide a password. Enter the password twice.

Reboot Apache Server

sudo /etc/init.d/apache2 restart

It’s probably a good idea to restart the Apache server one more time.

Browser Access
Next, open up your browser and access http://localhost/svn from the address bar. You will be asked for the username and password. You should see the repository and any content or directory underneath it. That’s it. Happy coding.