Git on WebFaction

How to setup and use Git on WebFaction

WebFaction supports Git

WebFaction has Git installed on all of their servers. Simply ssh into your account and type git help to start using it.

Why use Git on WebFaction?

Git is a popular distributed version control system. It adds easy branching, stashing, local development, and other features over Subversion. Although many developers use GitHub, you may want to use it on WebFaction if you already have a shared hosting account there. Many developers choose to host public repositories on GitHub while sticking to WebFaction for private repositories — since there's no limit to the number of repositories you can have on WebFaction other than by disk space.

Getting started with Git

Simply initialize an empty repository on the server to create a repo. On your local machine, you can checkout the repository via the ssh:// protocol and start committing to it.

# on the server
$ cd ~
$ git init --bare myrepo.git

# locally
$ git clone username@server.com:~/myrepo.git
$ cd myrepo
$ cat "Testing" > README.txt
$ git commit -a -m "First commit."
$ git push

Gitweb on WebFaction

Gitweb is a web interface for Git repositories. It's written in Perl and uses CGI. You'll get features like browsing trees, viewing file contents, reading logs, and comparing commits all through a web browser. Gitweb can be installed through the WebFaction control panel just like Wordpress or Django.

The steps to install the Gitweb application are:

  1. Go to the WebFaction panel at panel.webfaction.com
  2. Go to 'Domains/Websites' -> 'Applications' -> 'Add new application'
  3. Fill out the form and select "Git" for the application

Serving Git repositories over HTTP

All web applications are installed to your ~/webapps directory. The application will be installed into whatever directory name you chose in step 3. Inside will be another directory called repos. You can create your repositories here:

$ ssh username@server.com
$ cd ~/webapps/git-app-name/repos
$ git init --bare myrepo.git
$ cd myrepo.git
$ git config http.receivepack true

Now you can checkout your repository over http://:

$ git clone http://username@domain/path/to/myrepo.git

The username, domain, and /path/to are all determined by the information you filled in the form of step 3.

HTTP vs SSH

It's up to you to decide which protocol to use. Each has their pros and cons. With ssh://, you'll know that your authentication is safely encrypted. With GitWeb, you'll have a nice interface to browser your repository through a convenient web browser.

More Hosting Options

WebFaction is highly recommended for shared hosting. If you're looking for other types of services, check out Django Hosting.