A WordPress plugin to sync content with a GitHub repository (or Jekyll site)
Ever wish you could collaboratively author content for your WordPress site (or expose change history publicly and accept pull requests from your readers)?
Looking to tinker with Jekyll, but wish you could use WordPress's best-of-breed web editing interface instead of Atom? (gasp!)
Well, now you can! Introducing WordPress <--> GitHub Sync! ✨
-
Allows content publishers to version their content in GitHub, exposing "who made what change when" to readers
-
Allows readers to submit proposed improvements to WordPress-served content via GitHub's Pull Request model
-
Allows non-technical writers to draft and edit a Jekyll site in WordPress's best-of-breed editing interface
-
Allow teams to collaboratively write and edit posts using GitHub (e.g., pull requests, issues, comments)
-
Allow you to sync the content of two different WordPress installations via GitHub
-
Allow you to stage and preview content before "deploying" to your production server
The sync action is based on two hooks:
-
A per-post sync fired in response to WordPress's
save_posthook which pushes content to GitHub -
A sync of all changed files trigged by GitHub's
pushwebhook (outbound API call)
- Install the plugin and activate it via WordPress's plugin settings page.
- Over SSH:
cd wp-content/pluginsgit clone https://github.com/benbalter/wordpress-github-sync.git- Activate the plugin in Wordpress' Dashboard > Plugins > Installed Plugins
- Over FTP:
- Download the latest master ZIP
- Unzip
master.zipand upload it towp-content/plugins/wordpress-github-sync/ - Activate the plugin in Wordpress' Dashboard > Plugins > Installed Plugins
- Create a personal oauth token with the
public_reposcope. If you'd prefer not to use your account, you can create another GitHub account for this. - Configure your GitHub host, repository, secret (defined in the next step), and OAuth Token on the WordPress <--> GitHub sync settings page within WordPress's administrative interface
- Create a WebHook within your repository with the provided callback URL and callback secret, using
application/jsonas the content type. To set up a webhook on GitHub, head over to the Settings page of your repository, and click on Webhooks & services. After that, click on Add webhook.
WordPress <--> GitHub Sync exports all posts as .md files for better display on GitHub, but all content is exported and imported as its original HTML. To enable writing, importing, and exporting in Markdown, please install and enable WP-Markdown, and WordPress <--> GitHub Sync will use it to convert your posts to and from Markdown.
Found a bug? Want to take a stab at one of the open issues? We'd love your help!
See the contributing documentation for details.