New Plugin Syncs WordPress Content With a GitHub Repository

WordPress Versus Github

WordPress is excellent for writing posts privately by yourself and can be extended to allow collaborative writing with other registered authors. But what if you could open up your posts and revisions to even more contributors without requiring them to register to your site or even use WordPress?

WordPress <--> GitHub Sync is a new plugin that enables collaborative writing. It was created by Ben Balter, who has fully embraced this practice and hosts his blog on GitHub pages where you can view all of his drafts and revisions. Balter is also the creator of the first working prototype of what later became version 0.1 of the Post Forking plugin, which offers version control for writers working in WordPress.

Collaborative Writing with WordPress and GitHub

WordPress <--> GitHub Sync makes it possible for you to accept pull requests to your WordPress posts. Additionally, if you are blogging with Jekyll, the plugin enables you to author your Jekyll site with WordPress’ user-friendly web interface.

Balter outlines the three major benefits of 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

Whenever WordPress’ save_post hook is called, the plugin will fire a sync in response and will push the content to GitHub. In turn, GitHub’s push webhook will trigger a sync of all changed files back to WordPress.

When you install the plugin, you’ll need to enter your GitHub hostname and specify a repository to commit to. You’ll also need to enter your Oauth Token and Webhook Secret. At the bottom of the settings page, you’ll find bulk actions for exporting to GitHub and importing from GitHub, so it doesn’t necessarily have to be started on a brand new blog.

wp-github-sync-settings

In the future, Balter says the plugin may allow you to do even more, such as sync the content of two different WordPress installations via GitHub. It could also be adapted to allow you to stage and preview content before “deploying” to your production server.

For many writers the idea of writing in public may seem a bit daunting, but the practice and benefits are very much akin to writing open source code. Public revisions and incorporation of improvements bring a new transparency to the writer’s process and transforms the work into a shared community document. Publications that embrace collaborative writing have the potential to bring a whole new level of community participation to online journalism.

If you’re interested in experimenting with collaborative writing, Balter’s WordPress <--> GitHub Sync is a good starting point. Be advised that it’s still a work in progress. If you’d like to help make it better, please refer to the contributing documentation.

18 Comments


  1. This seems like an excellent way to backup WordPress content, as it would allow you to revert back and see older versions of posts if needed.

    Report


      1. WordPress has post revisions, but you can’t revert back the entire site to a specific point in time, only individual posts. It’s also not a backup system. And, there is a limit to how many revisions are stored, whereas that wouldn’t really matter with a Git repository.

        Report


  2. I’m guessing this will work with private repositories?

    Report


  3. Random question… but would it be possible to automatically post issues from github (aka something like this: https://github.com/gamelab/kiwi.js/issues/68) to your WordPress site as a blog post? And for the comments to appear as WordPress comments? Could I do that with this? That’d be freaking sweet!

    Report


  4. Thanks Sarah. I’m looking at IssuePress at the moment. And somebody else also mentioned IFTTT… that looks pretty cool too assuming it can do what it says :)

    Report


    1. If you can’t find something that works, let me know. It could be a fun weekend project.

      Out of interest, how would you use it?

      Report


  5. 1) I would install the Plugin
    2) I would sync it with my Github account
    3) I would select which repositories I want to sync in WP admin
    4) I would select a post category to associate the repository with
    5) I would click sync
    6) Its alive!!

    Now people could see the issues we’re working on either via our blog page OR by Github. It would also sync comments and post comments.

    Report


    1. Isn’t that a little redundant though? Why would people prefer your blog over your GitHub page? (Not sure I understand the point)

      Report


  6. Because some people don’t goto github to consume content and the visitors of our site are missing out on that.

    Report


  7. Maybe it’s enough for the plugin to just automatically create a blog post with a link to the corresponding issue on github?

    The problem is that we’ve got two different types of users (dev vs non dev) and yet while they have different surfing habits and consume different content its still relevant and I want the people on our blog to know stuff is happening over on github even though it might not appear so on the website.

    Why do people want WP Plugins that automatically post to Facebook and Google + or Instagram? Because its the way the world. Now that you understanding that what do you think?

    Report


    1. I think it is a very good idea. It can be very confusing for users to be sent off to a different service when it would make more sense to stay on your own site. It also allows you to keep your own branding. Sending people off to an external site just for a bug tracker could look very amateurish to some.

      Report


  8. I know this is an old post/thread, but I just wanted to let anyone who’s still following this know that I’ve been working with Ben Balter to get this plugin ready for production use and we’re getting really close to releasing it to the .org repository. If anyone is interested in playing around with it or beta testing, we’d love your feedback!

    Thanks.

    Report

Comments are closed.