Getting Git on GoDaddy

Ever needed to do some work on a shared hosting account on GoDaddy and not wanted to FTP files back and forth? Or wanted some form of back up and version control for your work? Unfortunately, GoDaddy shared hosting accounts do not come with git pre-installed. But it is completely possible to implement a sane development process using git on GoDaddy!

Turn on GoDaddy SSH

  1. After logging into your GoDaddy.com account, Launch the Hosting Control Panel.
  2. Expand Options & Settings
  3. Click on SSH in the Settings section
  4. Follow the instructions to enable SSH
  5. In a terminal, SSH to your GoDaddy server:
    1. $ ssh <your username>@<your domain name or IP address>
  6. Accept the fingerprint by pressing 'y'
  7. Enter your password

Note: If you would like password-less login via SSH, create an SSH key using ssh-keygen on your local computer and add the public key to the ~/.ssh/authorized_keys file (which you may need to create) on your GoDaddy server.

Get Git

  1. From your GoDaddy server, find out your server instance details at the command line:
    1. $ uname -a
    2. Linux xyz.secureserver.net 2.6.18-348.6.1.el5PAE #1 SMP Tue May 21 16:17:08 EDT 2013 i686 i686 i386 GNU/Linux
      
  2. Note the hardware platform: i386

  3. Find out the OS version at the command line:

    1. $ cat /etc/redhat-release
    2. CentOS release 5.5 (Final)
  4. Note the OS and version: CentOS release 5.5 (Final)

  5. Browse to http://pkgs.repoforge.org/git/ and figure out the rpm to grab for the latest git version: git-1.7.9.6-1.el5.rf.i386.rpm

  6. From your home directory, get the rpm:

    1. $ wget http://pkgs.repoforge.org/git/git-1.7.9.6-1.el5.rf.i386.rpm

Install Git

  1. Unpack git using rpm2cpio and cpio:
    1. mkdir ~/opt
    2. cd ~/opt
    3. rpm2cpio ~/git-1.7.9.6-1.el5.rf.i386.rpm | cpio -id
  2. Make sure that it is installed:
    1. ~/opt/usr/bin/git --version
    2. git version 1.7.9.6
  3. Get git on your path and tell Git not to do SSL verification. If you haven't already, create a ~/.bash_profile file and add the following to it:
    1. export GIT_SSL_NO_VERIFY=true
    2. PATH=$PATH:$HOME/opt/usr/bin
    3. export PATH
    4. GIT_EXEC_PATH=$HOME/opt/usr/libexec/git-core
    5. export GIT_EXEC_PATH
  4. Make sure these settings are working correctly by logging out and back in. Then check the version:
    1. git --version
    2. git version 1.7.9.6
  5. If bash doesn't know about git, try moving those settings to the .bashrc file instead of .bash_profile.
  6. Run the following commands to properly configure git:
    1. $ git config --global init.templatedir ~/opt/usr/share/git-core/templates
    2. $ git config --global remote.origin.uploadpack ~/opt/usr/bin/git-upload-pack
    3. $ git config --global remote.origin.receivepack ~/opt/usr/bin/git-receive-pack
    4. $ git config --global user.name "612softwarefoundry"
    5. $ git config --global user.email "hello@612softwarefoundry.com"

Test It Out

  1. Clone a repo:
    1. $ git clone https://github.com/612softwarefoundry/test.git
    2. Cloning into 'test'...
    3. remote: Counting objects: 3, done.
    4. remote: Total 3 (delta 0), reused 0 (delta 0)
    5. Unpacking objects: 100% (3/3), done.
  2. Make a change
    1. $ echo "*.log" > .gitignore
    2. $ git add .gitignore
    3. $ git commit "Ignoring .log files"
  3. Push to a repo:
    1. $ git push origin master
    2. warning: Setting remote service path not supported by protocol.
    3. Username for 'https://github.com': 612softwarefoundry
    4. Password for 'https://612softwarefoundry@github.com':
    5. warning: Setting remote service path not supported by protocol.
    6. To https://github.com/612softwarefoundry/test.git
    7.  4969a86..57568eemaster -> master

Noteworthy Item

Because GoDaddy blocks outgoing SSH access, I was unable to 'git clone' via SSH. Instead, I used HTTPS.

Go Get Your Git On!