Support » Plugin: WordPress GitHub Sync » What would it take to alter this plugin to work with private BitBucket repos?

  • Resolved Curtiss Grymala

    (@cgrymala)


    I’m just curious whether it would be possible to easily modify this plugin to work with private BitBucket repositories instead of requiring GitHub (presumably public) repos.

    I love the idea behind this plugin, as it allows us to store infinite revisions for things, and assign credit/blame to those revisions very easily. That said, there are instances where content managers put stuff in their pages/posts that shouldn’t be there (such as sensitive information), and it can be nearly impossible to permanently erase commits from a git repository.

    Since GitHub charges for private repositories, and since this plugin seems to require a separate repository for each individual site (we have nearly 300 separate sites where we’d potentially be tracking these changes), it’s unrealistic for us to try to manage that many private repositories on GitHub, even if it is possible to make this plugin work with private GitHub repos (I haven’t tested that functionality yet to see if it even works).

    On the other hand, BitBucket allows unlimited private repositories, so it would be much simpler to create and manage the hundreds of repos we’d need to make this plugin work for us.

    I’m not sure what kinds of changes would need to be made to the plugin, so I don’t know if this is something you could easily add to the plugin, or if we’d be better off trying to develop a new plugin for the purpose of using it with private BitBucket repos. Thanks.

    https://wordpress.org/plugins/wp-github-sync/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author James DiGioia

    (@jamesdigioia)

    Well, there’s a couple things I will say:

    1. It should work fine with private GitHub repositories, as long as the oAuth token has access to them, though I haven’t tried specifically myself. The plugin has been developed with an eye towards allowing outside contributions, though I could see this being useful if you give certain people access to a private repo without giving them an account on the site.
    2. It’s very possible to remove sensitive data/commits from a git repository, though it may be a bad idea for all sorts of reasons, e.g. you’d break everyone’s local repo if you rewrote the remote repo’s history.
    3. Theoretically, it should be possible to swap out the API layer from GitHub to Bitbucket. However, I quickly poked through the API documentation for Bitbucket, and it doesn’t appear the endpoint we’re using for GitHub is available in Bitbucket. We’re heavily leveraging the Git Data endpoint: https://developer.github.com/v3/git/ which allows us to manipulate the git database directly. We previously used the contents API, but that was resulting in lots of extra commits (if you renamed a post: 2 commits, one to delete the old path and one to add the new one; if you did a full site export: 1 commit for every post in your database, etc.).

    If Bitbucket doesn’t provide the same level of granular access to their git repositories (which they may not, considering their infrastructure supports both git and mercurial, therefore dividing resources between them), then the implementation is going to be a very different experience using WPGHS w/ Bitbucket than GitHub.

    I’m currently in the middle of a pretty significant rewrite of WPGHS, making it more modular and testable. Once that’s complete, it would be a lot easier to either add a second, swappable API client and/or remove and replace the current API client. That work is ongoing here: https://github.com/benbalter/wordpress-github-sync/pull/98

    But you’d still have to write the API client to work the same way against both BB + GH, and though I haven’t looked into it in any depth, I don’t know if the BB API capabilities are there.

    However, if all 300 sites are managed through a single WordPress Multisite, maybe modifying the plugin so the entire network uses a single repository may be a better way to go.

    Unfortunately, though, neither solution is necessarily something I’m going to be implementing myself in my free time. I’d be happy to talk through the ideas for either solution and include your contributions back into to the core plugin, but I don’t think at this point I have the time/use case for building those features myself.

    Thread Starter Curtiss Grymala

    (@cgrymala)

    Sorry for taking so long to get back to you.

    Thank you for the in-depth and well-reasoned response. I understand the issues you mentioned, and look forward to digging through things now that you’ve rewritten the plugin. Thanks, again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What would it take to alter this plugin to work with private BitBucket repos?’ is closed to new replies.