-
-
Save 5eleven/2484313 to your computer and use it in GitHub Desktop.
Ready a live site for deployment via Git instead of FTP, and keep the git directory separate from the working tree on the server.
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 you the site is served from ~/www/example.com/ and you want the git directory to live in ~/git/ | |
# Keep in mind that ^C is Control-C, or what ever the command is for your server to halt a program. | |
mkdir ~/git/example.com.git && cd ~/git/example.com.git | |
git init --bare | |
git config core.bare false | |
git config core.worktree ~/www/example.com | |
git config receive.denycurrentbranch ignore | |
cat > hooks/post-receive | |
#!/bin/sh | |
git checkout -f | |
^C | |
chmod +x hooks/post-receive | |
git add ~/www/example.com/* | |
git commit -m "Initial commit." | |
# On the desktop | |
# Assuming you want the remote to be called "live" and you want the entire project to live in ~/www/ | |
mkdir ~/www/example.com && cd ~/www/example.com | |
git init | |
git remote add live ssh://[email protected]/home/user/git/example.com.git | |
git pull live master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment