Git Publish to shared server (eg: GoDaddy ssh)
As a web developer, there’s nothing more I hate than not having the right tools to get the job done quickly or at an optimal speed. Aside from that, many hosting servers, for example GoDaddy, makes it even frustrating to work without access to version control and sometimes without SSH access when your clients hosting plans is on a shared plan. Not able to use Git (or SVN which ever you prefer) makes it a pain in the ass to commit changes, update the site quickly and show your talents.
So you know what I did of course, yes you do. I created an alternative tool that would alleviate the suffering of having to use FTP each time to update the website. I present to you my version of Git Publish to GoDaddy shared servers and the likes:
The script is very simple to use, just edit your SSH settings within the file then open up that trusty terminal window and run as such:
sh Git_Publish_To_Shared_Server.sh
The script will archive in a file the latest git commits since you last did your Git Push. It will secure copy the archived (tar.gz) file to your SSH server, then extract the archived file and update your remote files instantly.
The script checks if the current repository is clean or dirty, which will warn you in case its not clean. After you’ve commited your changes locally, its time to upload the most latest changed/added files to the website hosting via SSH. But don’t worry too much, the only thing the script asks you each time is your ssh password. (No, it does not store the password nor send it over to me) … just take a look and see how tiny yet useful it will be to you.
Happy Hacking.

Jay Swain 12:57 am on October 13, 2010 Permalink
How did you get around the password prompt when doing the scp?
Josue R. 7:27 pm on October 13, 2010 Permalink
It doesn’t bypass the scp password prompt. I left it on the script so its safer to prompt than storing your password and piping it to scp. If you use this script on a server which you have SSH password-less access configured (aka your public ssh key on the server) then the password should not prompt you.
Massage Cushion 5:43 am on November 8, 2010 Permalink
godaddy is not always the best registrar, the private registration of godaddy is too expensive.
Electric Griddle 3:41 pm on January 24, 2011 Permalink
I am very thankful to this topic because it really gives great information
Josh 4:17 pm on April 1, 2011 Permalink
Sorry I’m a shell script noob, but is this all about wrapping up local Git changes and pushing them via scp?
I found this great post about setting up Git on Godaddy via a prior build created on a Virtual Box! Seems to work like a charm http://johntrammell.com/wp/2011/01/05/using-git-on-godaddy/
Greg 10:47 pm on September 27, 2011 Permalink
I am two weeks into using GIT and I’m already using your script to post from my VPS to a GoDaddy account. This works well! My only question is why have you asked to Push changes to remote repo at the end of the script?
Josue R. 8:24 pm on January 6, 2012 Permalink
@Josh pushing files via “scp” because GoDaddy didn’t make it easy to go regular “git push”. (Its been a long while so i think they might have updated their hosting to allow Git – unfortunately i’m no longer with GoDaddy neither recommend them to anyone.)