setup Git on Godaddy linux economy host

There is no version control on Godaddy linux host, which makes the code deployment very painful. So here is how to setup Git on the Godaddy host.

In this tutorial, we set repository on the Godaddy host.

1. download the pre-build git binaries, Godaddy uses CentOS, and the binary is built under CentOS. (Thanks to here)
In your $HOME folder on Godaddy host

% mkdir lib
% cd lib
% mkdir git
% cd git
% wget
% tar -xvzf centos5.2-git.tar.gz

2. edit the $HOME/.bash_profile file, add the following lines:(please change the /your/home/path part)

export GIT_PATH=/your/home/path/lib/git
export PATH=$PATH:$GIT_PATH/libexec/git-core
export GIT_EXEC_PATH=$GIT_PATH/libexec/git-core
export GIT_TEMPLATE_DIR=$GIT_PATH/share/git-core/templates

3. create repository in godaddy host, you can create the folder anyware you like, I use $HOME here

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

4. clone the repository on your local machine

git clone -u lib/git/libexec/git-core/git-upload-pack username@site_url:~/mysite.git

5. config the git remote path on your local machine

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

6. in godaddy host, change the .git/config file, add the following codes: (please change the /your/home/path part)

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = /your/home/path/mysite.git
[branch "master"]
        merge = refs/heads/master
        remote = origin

7. Now you can try git push, git commit on your local machine and git pull on your godaddy host

Leave a Reply

Your email address will not be published. Required fields are marked *