I'm sure there are others interested in doing this, so here's how I did it:
* Must have SSH access on your website's host server *
** Must have Git installed on Remote and Local **
I'm not going into details about how to do the above.
I'm going to reference my own set up configuration.. use your brain to fill in the correct info for your own site.
If you have questions, send me an email, tweet me, google+ or whatever.
How I set up my Git workflow
 
Part 1: Site Hub (bare repository)
SSH into joejiko.com's root ~/
Make a folder in the root directory to house the bare repository. (eg. ~/site.git)
Initialize a bare git repository:
git init   --bare
Create a post-receive hook to push the working directory to the site's public folder
The post-receive hook goes into the bare repository's hooks folder (eg. ~/site.git/hooks/post-receive
Its contents look like this:
post-receive
#!/bin/sh 
GIT_WORK_TREE=/home/USER/public_html/ git checkout -f

Make sure the directory exists!
Chmod +x your post-receive file
In your SSH client, navigate to your hooks directory and use
chmod +x post-receive

 
Part 2: Local Repo
Set a folder to hold your site files and initialize your Git repository
git init

Add the site files and commit
git add .
git commit -m "initial commit"

Add the remote server and push
git remote add web ssh://site.com/home/USER/site.git
git push web +master:refs/heads/master

 
That's it!
If you need more instruction, you can try "Using Git to manage a web site" which basically goes through the same process (only in much more words)
I'll update this as I continue to use this workflow and become more familiar with Git
 
If you have anything to add or see a mistake, please let me know!
 
Some additional notes/things to google:
* SSH keys. SSH is much easier if you use keys (so you can push with a special password instead of your username and the password on your hosting account that's probably super annoyingly "secure")
Related reading:

Similar Posts