Question

How to add to git the wordpress installation

Posted April 28, 2016 3.5k views
WordPressGit

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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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: https://github.com/settings/keys
  • 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.

Submit an Answer