Wordpress Revisr Setup
Created at 2016-04-29T00:59:16.000Z

The result of following setup is on github: hi-ogawa/wordpress-revisr.

Ignore all but theme files

Here is a .gitignore file only for tracking changes on simple-mag theme.

*
!/wp-content/
/wp-content/*
!/wp-content/themes/
/wp-content/themes/*
!/wp-content/themes/simple-mag/
!/wp-content/themes/simple-mag/*

Setup remote repository

I didn't want to hard-code my password for remote repository https url. So, I tried ssh version of url.

Here is a screenshot of Revisr setting:

2016-04-29_1845

First, generate ssh private/public keys for user www-data.

$ sudo mkdir /var/www/.ssh
$ sudo chown www-data:www-data /var/www/.ssh
$ sudo su - www-data -s /bin/bash -c ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/www/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/www/.ssh/id_rsa.
Your public key has been saved in /var/www/.ssh/id_rsa.pub.
...

Second, save generated public key to github repository as deploy key:

2016-04-29_1849

Then, make sure connection is fine. Here I had a problem, so I'll show my workaround:

# it fails for some reason I don't know
$ sudo su - www-data -s /bin/bash -c 'ssh -T git@github.com'
Host key verification failed.

# that's why I forced to add github.com as known host
$ sudo su - www-data -s /bin/bash -c 'ssh -o StrictHostKeyChecking=no -T git@github.com'
Warning: Permanently added 'github.com,192.30.252.121' (RSA) to the list of known hosts.
Hi hi-ogawa/wordpress-revisr! You've successfully authenticated, but GitHub does not provide shell access.

# then it's fine for all
$ sudo su - www-data -s /bin/bash -c 'ssh -T git@github.com'
Hi hi-ogawa/wordpress-revisr! You've successfully authenticated, but GitHub does not provide shell access.

References