How to add to git the wordpress installation

April 28, 2016 3k views
Git WordPress

I used wordpress in my app and installed it in ubuntu. We will be working in a team - I wonder if we can put do version control with wordpress app?

2 Answers

If you mean you want to make it so your WordPress site is on GitHub/GitLab/etc. it’s fairly simple:

  • Make sure you have SSH keys configured on your server.
  • Copy your public SSH key on the server
  • On the Git service you’ve decided to go with, add the public key. I’m going to assume GitHub going forward
  • for github, you’d go here:
  • Create the repository on the git service of your choice (I use GitHub – you pay $7.00USD a month, and you get 5 private repositories)
  • Once you create the repo, go to the repo. It will have the commands you need to run to set up your existing code as a repository.
  • You’ll want to back up your database and upload it as well, so follow this guide to use mysqldump

Hi - Straightforward, but is this the most secure way? The one-click distros give you 1 user, root, and following these steps would add root’s public key to github/bitbucket, right? And any git-pull would pull down files with root:root permissions, no?

If this is not correct, please include a blurb about how to add another non-root user as part of the steps. Or provide info about chown -R www-data:www-data after a pull as root to ensure apache (or ngynx) won’t have trouble getting at them.

Have another answer? Share your knowledge.