Reputation: 11479
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.
Upvotes: 19
Views: 42922
Reputation: 411
I had to set up git on a VPS hosted at http://netgonian.com (GoDaddy reseller). What took 3 hours could have been done in about 15 minutes and super easy.
Installing git should be as simple as running yum install git
but unfortunately trying that gave me all sorts of could not find file errors. Below was the final solution.
Here are the steps:
su -
yum install git
and it will work.The basic issue was that all the base urls for yum were pointing to some server on the secureserver.net that was missing all the needed files. What we are doing above is pointing the base urls to servers that have the needed files.
Upvotes: 0
Reputation: 703
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:
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:
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:
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
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.
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.
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.
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.
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!
Upvotes: 10
Reputation: 501
I found another useful guide to install git on GoDaddy at http://www.612softwarefoundry.com/getting-git-on-godaddy/
Upvotes: 1
Reputation: 504
The instructions in this blog post worked for me, except that I had to visit EPEL and find the newest version of the git RPM: http://hire.chrisjlee.net/node/139
cd ~
mkdir git
cd git
# Download the rpm from EPEL ( http://fedoraproject.org/wiki/EPEL )
# Find the latest version by checking http://dl.fedoraproject.org/pub/epel/5/i386/
wget http://dl.fedoraproject.org/pub/epel/5/i386/git-1.8.2.1-1.el5.i386.rpm
# Extract binaries from the rpm
rpm2cpio git-1.7.4.1-1.el5.i386.rpm | cpio -imdv
rm git-1.7.4.1-1.el5.i386.rpm
echo "
export GIT_BIN=${HOME}/git
export PATH=${GIT_BIN}/usr/bin:${PATH}
export GIT_EXEC_PATH=${GIT_BIN}/usr/bin
export GIT_TEMPLATE_DIR=${GIT_BIN}/usr/share/git-core/templates
export GIT_SSL_NO_VERIFY=true" >> ~/.bashrc
mkdir ~/.git
git config --local --add remote.origin.uploadpack ~/git/usr/bin/git-upload-pack
git config --local --add remote.origin.receivepack ~/git/usr/bin/git-receive-pack
Upvotes: 0
Reputation: 4364
There is a YouTube tutorial explaining how to set up Git on a Godaddy Shared Hosting account. Here is the link: http://youtu.be/z60GLfsGGsY
There is also a webpage with the commands that you will need to execute on the video. Here is the page address: http://www.drupalfever.com/linux-how-to/git/set-up-git-in-a-godaddy-shared-hosting-account
If you have any question, leave me a note or suggestion.
Upvotes: 0
Reputation: 26129
Connect via ssh.
Install git to ~/git.
After that create/update these files:
~/.ssh/authorized_keys
command="~/connect.sh" ssh-rsa AAAAB3NzaC...
~/connect.sh
#!/bin/bash
if [ -f "${HOME}/.env_profile" ]; then
source ~/.env_profile
fi;
if [ "x${SSH_ORIGINAL_COMMAND}x" == "xx" ]; then
$SHELL --login
else
eval "${SSH_ORIGINAL_COMMAND}"
fi;
~/.env_profile
export ENV_VARIABLE=value
by git:
export PATH=$PATH:$HOME/bin:$HOME/git/libexec/git-core
export LD_LIBRARY_PATH=$HOME/git/lib
export GIT_EXEC_PATH=~/git/libexec/git-core
export GIT_TEMPLATE_DIR=~/git/share/git-core/templates
I spent about a week to google this out, but it's working like charm now... I don't think there is another solution by godaddy accounts, the possibilities are too limited by them...
Upvotes: 2
Reputation: 1749
I was successful following the directions here:
http://www.krizka.net/2010/12/30/setting-up-a-public-git-repository-with-godaddy-shared-hosting/
The keys (for me) were
Upvotes: 3
Reputation: 1429
I maitain git locally and use scp to push live... it's not elegant, but godaddy has scp installed my default.
"scp -r fooDirectory [email protected]:/path/to/document/root/"
that will move a local directory "fooDirectory" to "/path/to/document/root/fooDirectory" on the remote host.
when you are logged into go daddy use "pwd
Upvotes: 2
Reputation: 137282
First, you will need to have git installed on GoDaddy. I'm not sure if this is possible. Git supports local user installs, but you need to have certain development tools handy to do it. Download git, and see if you can ./configure && make && make install
-- if so, it will put it in your ~/bin
directory.
We use git extensively for controlling production. But rather than deploying on push, may I suggest that you ssh to the box and do a git pull
?
More specifically, create a "Release" branch, and then when you are ready to deploy, simply merge your changes into the Release branch, ssh to the server, and git pull.
For example
ssh [email protected]
cd /path/to/project
#ok, assuming you are on the Release branch
git fetch
git merge branch-with-new-changes-on-it
# update the remote Release branch with the merge
git push origin HEAD
This simple workflow allows developers to see exactly what is on the production server at all times, and to merge other changes in with theirs before asking for a deployment. In fact, we require that all production changes be fully merged before requesting a deployment of your branch.
--
If you do manage to get git installed on GoDaddy, and you REALLY want to auto-deploy when you push to it, then take a look at the post-update
hook.
http://git-scm.com/docs/githooks
--
If you cannot get git installed on GoDaddy, then see if they support rsync. Then you can have a simple bash script somewhere that will
--
There are many ways to do it. Perhaps this will help with direction a bit...
Upvotes: 3