- Init local git repository (remember to create
.gitginore
withwp-config.php
before staging anything) - Configure SSH-key access to server with git [https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/, https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Transfer_Client_Key_to_Host]
- Init a bare repo on the server
git init && git config core.bare true
- Create a new post-receive hook with
nano .git/hooks/post-receive
(content see below!) - Execute
chmod 755 post-receive
on the script - Add remote to local repository
git remote add staging [email protected]:www/your-website
- Try pushing
git push staging master
- Check if everything works as expected.
- Add a
.htaccess
to the.git
directory with content:deny from all
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
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access plus 1 year" | |
# Data interchange | |
ExpiresByType application/atom+xml "access plus 1 hour" |
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
<?php | |
/** | |
* GitHub webhook handler template. | |
* | |
* @see https://developer.github.com/webhooks/ | |
* @author Miloslav Hůla (https://github.com/milo) | |
*/ | |
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check |