Setting up a git repo on my GoDaddy hosting plan

git

Solution

With a little work, I was able to get Git running on my GoDaddy account. There's a longer posting detailing the process on my blog, but the short answer is:

- install git in your account (perhaps using the tarball referenced in my blog post)

- create a git repository (bare or not) in your account

check out your repository, using -u to indicate the path to `git-upload-pack`

% git clone -u libexec/git-core/git-upload-pack mysite:myrepo.git

tweak your local repository config to point to the correct paths to `git-upload-pack` and `git-receive-pack`:

% git config remote.origin.receivepack libexec/git-core/git-receive-pack % git config remote.origin.uploadpack libexec/git-core/git-upload-pack

Since the blog is no longer accessible, here is the full post pulled from archive.org:

Using Git on GoDaddy

This blog is hosted on a cheap GoDaddy account. When shell access over SSH was recently made available, I thought it would be fun to install local git repositories. It wasn’t trivial, but I did finally get it working. Here’s how I did it:

Step 0. Configure SSH

You want to create a public key so you can SSH in to your GoDaddy account painlessly. Create a key pair if you don’t already have one, and add it to `~/.ssh/authorized_keys`. I’ll assume an entry in `~/.ssh/config` something like this:

Host mysite
HostName mygodaddysite.com
User mylogin

Step 1. Install Git

After poking around on my GoDaddy host, I discovered it was running CentOS 5.2. Binaries running on my laptop weren’t compatible, so I used VirtualBox to set up a local Centos 5.2 install and build Git. I’m sharing a tarball containing the pre-built CentOS 5.2 Git binaries. You should be able to download and install with the commands:

wget http://johntrammell.com/centos5.2-git.tar.gz
tar xzf centos5.2-git.tar.gz

Enjoy this part–I’ve saved you a couple hours’ work here.

Step 2. Set up your environment.

Add the following to your .bash_profile:

export EDITOR=vim
export PATH=$PATH:$HOME/bin:$HOME/libexec/git-core
export LD_LIBRARY_PATH=$HOME/lib
export GIT_EXEC_PATH=~/libexec/git-core
export GIT_TEMPLATE_DIR=~/share/git-core/templates

This will set your environment up correctly on an interactive shell. Unfortunately I can’t seem to get the PATH to set correctly for non-interactive SSH commands. For example, when I run this command from my laptop:

ssh mysite env

I see the default PATH. This is also the case when I set the path in .bashrc. I haven’t tracked down exactly what SSH does on non-interactive access, but this may be related to the PermitUserEnvironment setting in sshd. Luckily we can work around this.

Step 3. Creating a repository

Log in to your GoDaddy account, and create a simple “bare” Git repository:

% mkdir myrepo
% cd myrepo
% touch README
% git init
% git add README
% git commit -m 'empty git repository'
% cd ..
% git clone --bare myrepo myrepo.git

You now have a bare repository in `~/myrepo.git/` in the root of your GoDaddy account.

Step 4. Checking out your repository

The only tricky part to this is that you have to tell git where to find git-upload-pack. This works around the PATH problem mentioned above. On your local machine, do this:

git clone -u libexec/git-core/git-upload-pack mysite:myrepo.git

You should now have a copy of the original minimal repository checked out.

Step 5. More git configuration tweaks

Sadly we are not done:

% cd myrepo
% echo "foo" > README
% git commit -am 'updated'
[master 044c086] updated
 1 files changed, 1 insertions(+), 0 deletions(-)
% git push
bash: git-receive-pack: command not found
fatal: The remote end hung up unexpectedly

Our PATH problems are interfering with the push operation now. As a workaround, we can either specify –receive-pack on the command line, or set it in the local configuration (the same applies for fetch operations and –upload-pack):

% git config remote.origin.receivepack libexec/git-core/git-receive-pack
% git config remote.origin.uploadpack libexec/git-core/git-upload-pack

Congratulations, you should be up and running now!

Resources

- http://johntrammell.com/centos5.2-git.tar.gz

- https://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan

- Setting up a git repo on my GoDaddy hosting plan

- git-upload-pack: command not found, how to fix this correctly

- http://www.bluehostforum.com/showthread.php?20304-Bluehost-Solution-to-the-Git-PATH-issue-when-using-a-non-interactive-shell

- http://www.google.com/search?q=ssh+setup

- http://www.kernel.org/pub/software/scm/git/docs/git-upload-pack.html

- http://www.kernel.org/pub/software/scm/git/docs/git-receive-pack.html

Problem

I have a project which is version-controlled using git. What I want to be able to do is set up a repo on my (ssh-enabled) GoDaddy shared hosting package so that I can deploy with a push rather than dragging and dropping in FTP. Any tips would be appreciated. Best would be an account from someone who's already done it, but I couldn't personally find any online.

Original source

Related problems