Infrastructure

  • Server Setup
  • LAMP Configuration
  • Network Design and Setup
  • Email Setup
  • Cloud: Amazon EC2, Google App Engine
  • Database: MySQL, PostgreSQL, Oracle, DB2

Mobile

  • iOS
  • Android
  • Blackberry
  • WebOS
  • HTML4 and HTML5

Web

  • HTML4, HTML5, JavaScript
  • Java, J2EE, Spring
  • Groovy, Grails
  • PHP
  • Perl
  • Google App Engine
  • SQL, PL/SQL

Using Git on GoDaddy’s SSH-Enabled Virtual Webhosts

Tuesday, July 19, 2011
posted by Admin

Recently I’ve switched to using Git for version control for my day-to-day projects. I also finally got around to updating the website theme. This brings me to the point of the post.

I’ve been using GoDaddy’s virtual web hosting, no this isn’t a GoDaddy plug, I could take them or leave them. After enabling the SSH feature through the control panel so I didn’t have to deal with ftp I quickly decided that it was time to use Git. The problem is that GoDaddy doesn’t support Git on their virtual webhosting service.

So the following is a list of steps to get everything setup.

  • Statically compile Git
  • Install Git on virtual web hosting
  • Setup ssh
  • Git workaround for pull, push, fetch

Statically Compile Git
1) Find a 32bit linux box to use for this step. The virtual host I used was 32bit based. I believe all of their virtual hosts are 32bit based, but you can verify by running:

$ uname -m
i686

2) Download the latest version of Git source. Create a directory to contain the compiled binaries.

$ tar -jxvf git-1.7.6.tar.bz2
$ mkdir ~/git-scm
$ cd git-1.7.6
$ ./configure --prefix=~/git-scm CFLAGS="${CFLAGS} -static"

3) Compile and install git into ~/git-scm.

$ make
$ make install

4) Package the statically compiled Git for install on the GoDaddy virtual host.

$ cd ~/
$ tar -jcvf git-static-1.7.6.tar.bz2 ~/git-scm

Setting up SSH and installing Git
1) Creating an ssh public / private keypair is not required, but makes it easier to use git commands if you don’t have to enter your password each time a remote command is run.

# On your local system
$ ssh-keygen -t rsa -b 2048 -C "myid@goDaddy"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/abrons/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/abrons/.ssh/id_rsa.
Your public key has been saved in /Users/abrons/.ssh/id_rsa.pub.
The key fingerprint is:
...

2) Log into your GoDaddy account and setup the RSA public key for password-less authentication.

# SSH to GoDaddy Host
$ mkdir ~/.ssh
$ cd ~/.ssh
$ vi authorized_keys
# Copy the contents of local system myId@goDaddy.pub into authorized_keys
$ chmod 600 authorized_keys
$ chmod 700 ~/.ssh

3) Configure local system ssh client to connect as you with using a host alias.

$ cd ~/.ssh
$ vi config
# Put the following in your config file change "myhost" and "myid" with your
# GoDaddy host and userid
Host myHostAlias
HostName myhost
User myid
IdentityFile ~/.ssh/myid@goDaddy

Install Static Git
1) Use secure copy to copy the git-static-1.7.6.tar.bz2 tarball to the GoDaddy virtual web host and install.

# From local system
$ scp ~/git-static-1.7.6.tar.bz2 myhost:

2) SSH to your goDaddyHost and install the git binaries.

$ ssh myHostAlias
$ tar -jxvf git-static-1.7.6.tar.bz2
$ vi ~/.bash_profile
# Add the git binaries to your execute path
# Find the line that has "PATH=" or add one
PATH=${PATH}:${HOME}/git-scm/bin

3) Example git repository of GoDaddyHost/html

$ ssh myHostAlias
$ cd ~/html
$ git init
# NOTE: Do NOT do the following if you plan to make changes to ~/html locally
#           instead create a bare git repository that both GoDaddy and your local system
#           push and pull to/from.
$ git config receive.denyCurrentBranch ignore

4) From your local system clone the myHostAlias(GoDaddyHost) html git repository. You’ll notice the “-u”, this is required because GoDaddy does not allow you to override the PATH variable for a non-interactive ssh session such as git over ssh.

$ git clone -u /home/content/a/d/a/myid/git-scm/bin/git-upload-pack myHostAlias:html

5) Setting up Git paths for push, pull, and fetch on GoDaddyHost. On the local system cloned repository.

# Replace "/home/content..." with the FULLPATH on your GoDaddyHost to the git-upload-pack binary
$ git config remote.origin.uploadpack /home/content/a/d/a/myid/git-scm/bin/git-upload-pack

# Replace "/home/content..." with the FULLPATH on your GoDaddyHost to the git-receive-pack binary
$ git config remote.origin.receivepack /home/content/a/d/a/myid/git-scm/bin/git-receive-pack

3 Responses to “Using Git on GoDaddy’s SSH-Enabled Virtual Webhosts”

  1. David says:

    Super instructions! Thank you ~

  2. David says:

    One note: in your instructions " shows up. For example:

    $ ./configure –prefix=~/git-scm CFLAGS="${CFLAGS} -static"

  3. ambrons says:

    David, thanks for pointing out that the quotes where showing up encoded.

Leave a Reply