Skip to content

Instantly share code, notes, and snippets.

@thejhh
Created August 7, 2011 01:38
Show Gist options
  • Save thejhh/1129967 to your computer and use it in GitHub Desktop.
Save thejhh/1129967 to your computer and use it in GitHub Desktop.
How to update files at remote website by running 'git publish'

Alias for git is configured into the file .git/config:

[alias]
	publish = !sh ./scripts/publish.sh

The script file ./scripts/publish.sh looks like this:

#!/bin/sh
set -e
git push user@remote:path/to/clone/
ssh user@remote 'cd path/to/clone && git checkout -q -f'

Now it can be published by simply executing git publish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment