Created
April 27, 2012 03:34
-
-
Save Kerrick/2505559 to your computer and use it in GitHub Desktop.
Create a new website and deploy it via Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the server | |
# Assuming the site is served from ~/www/example.com/ and you can hide the .git directory from public view | |
# Keep in mind that ^D is Control-D, or what ever the command is for your shell to stop input. | |
mkdir ~/www/example.com && cd ~/www/example.com | |
git init | |
git config core.worktree ~/www/example.com | |
git config receive.denycurrentbranch ignore | |
cat > .git/hooks/post-receive | |
#!/bin/sh | |
git checkout -f | |
^D | |
chmod +x .git/hooks/post-receive | |
echo "Hello, world." > index.html # You can replace this with your initial development work if you like. | |
git add . | |
git commit -m 'Initial commit.' | |
# On the desktop | |
# Assuming you want the entire project to live in ~/www/example.com | |
cd ~/www | |
git clone ssh://user@example.com/home/user/www/example.com | |
cd ~/www/example.com | |
# More development work, yay! Don't forget to add and commit things as you go. | |
# To deploy: | |
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the server | |
# Assuming the site is served from ~/www/example.com/ and you can hide the .git directory from public view | |
# Keep in mind that ^D is Control-D, or what ever the command is for your shell to stop input. | |
mkdir ~/www/example.com && cd ~/www/example.com | |
git init | |
git config core.worktree ~/www/example.com | |
git config receive.denycurrentbranch ignore | |
cat > .git/hooks/post-receive | |
#!/bin/sh | |
git checkout -f | |
^D | |
chmod +x .git/hooks/post-receive | |
# On the desktop | |
# Assuming you want the entire project to live in ~/www/example.com | |
mkdir ~/www/example.com && cd ~/www/example.com | |
git init | |
git config core.worktree ~/www/example.com | |
echo "Hello, world." > index.html # You can replace this with your initial development work if you like. | |
git add . | |
git commit -m 'Initial commit.' | |
git remote add origin ssh://user@example.com/home/user/www/example.com | |
# More development work, yay! Don't forget to add and commit things as you go. | |
# To deploy the first time: | |
git push origin master | |
# To deploy from then on: | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment