background preloader

Git Workflow with Shared Hosting

Facebook Twitter

How to deploy sites via GitHub · @mdo. 02 Nov 2011 After one my last posts about GitHub and how it's saved my ass a number of times, I had a few requests to detail just how I deploy sites with GitHub.

How to deploy sites via GitHub · @mdo

So, here we go! First, some background I host this site, and a number of others, with Media Temple. My code, however, is verson-controlled with GitHub, where I have a paid account, the $12/month plan. Using GitHub for site deployment is pretty straight forward. Now, the how-to After covering the background details, the rest of this how-to assumes you have a paid GitHub account (for the private repo), SSH access enabled, and git installed on your server. Setting up a private GitHub repoCloning your repo locallyAdd some codeCloning your repo via SSHHandling maintenanceFew other tips Now, let's get to it! 1. The first step is to create a private repo on GitHub.com. When you create your new repo, just check the option that says "Only the people I specify" for repo access. 2.

How to install Git on a shared host. (regularly updated) Installing Git on a shared hosting account is simple, the installation is fast and like most things Git, it just works.

How to install Git on a shared host

This is a basic install without documentation. My main goal is to be able to push changes from remote repositories into the hosted repository, which also serves as the source directory of the live website. Like this. Prerequisites The only two things you absolutely must have are shell access to the account and permission to use GCC on the server. . $ ssh joe@webserver 'gcc --version' gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50) [...] If GCC replies with a version number, you should be able to install Git. If you see something like /usr/bin/gcc: Permission denied you don’t have access to the GCC compiler and will not be able to build the Git binaries from source. Update your $PATH None of this will work if you don’t update the $PATH environment variable. Export PATH=$HOME/bin:$PATH Double-check this by sourcing the file and echoing $PATH:

A web-focused Git workflow. After months of looking, struggling through Git-SVN glitches and letting things roll around in my head, I’ve finally arrived at a web-focused Git workflow that’s simple, flexible and easy to use.

A web-focused Git workflow

Some key advantages: Pushing remote changes automatically updates the live siteServer-based site edits won’t break historySimple, no special commit rules or requirementsWorks with existing sites, no need to redeploy or move files Overview The key idea in this system is that the web site exists on the server as a pair of repositories; a bare repository alongside a conventional repository containing the live site. Two simple Git hooks link the pair, automatically pushing and pulling changes between them. The two repositories: Hub is a bare repository. Using the pair of repositories is simple and flexible. Getting ready. Mislav/git-deploy. Common SSH Commands. When you first log into your server, you will be in your home directory.

Common SSH Commands

Linux uses a nested folder structure to store different files. The top-level directory is considered the root directory, and is designated by /. Folders beneath the root level are separated by slashes. For example, all of your website content is located in /home/00000/domains/example.com//var/www/vhosts/example.com/. On the Grid, you can't do anything above your server directory. SSH without a password not working. I am still working on this one, and would love some input.

SSH without a password not working

I tried the ssh -vv command, and it appears that the key is just not being accepted. At I tried creating both a dsa key, and an rsa key, but neither worked. Here is some of the output of the -vv option... Does anyone see anything that stands out? Installing Git version control on a shared hosting provider - Stu Miller. Due to a server upgrade, my ‘staging environment’ hosting provider, Aspiration Hosting broke the self compiled version of Git I had running on the server, which meant I had to go digging once more to remember how I installed it without root access in the first place.

Installing Git version control on a shared hosting provider - Stu Miller

Here it is so I (and potentially others) don’t have to do it again. Essentially, what you’re going to be doing is compiling and installing Git from source. Sounds scary? Not really – just make sure you follow the commands below and all should be well. Before you start In order to install Git on a shared hosting you must have the following. SSH access into your hosting providerCompiler access – test this by running the command gcc –version. All sorted? Logged into your hosting and in your home folder, run the following commands; (NB: You can find the latest Git source from here, so replace the link below with the most recent stable release)