Reputation: 50
I'm in the progress of setting up a development and live development environment for some basic projects I'm working on. Ideally I want git
to push changes from the development server to the live site. However I want each version to use the exact same database so the posts and content are identical at all times.
Obviously the Site URL
is set to only the live site so the development site's links don't work. If I overrode the site url
in the wp-config.php
file of each and used .gitignore
to ignore both wp-config.php
files would this be enough for this to work or is there something else I'm missing?
I'm posting in the hope somebody has tried it before me and that might have any answers to problems I encounter now or in the future.
Thanks in advance, Ollie
Upvotes: 0
Views: 46
Reputation: 2393
Make sure you add the .gitignore entry before changing and committing the wp-config.php
.
Once you update wp-config.php, it's going to go through and update URLs in the database. Since WordPress is stateless - to say there is no session management, there is no way of tracking if a database has been swapped.
Lastly, WordPress uses a MySQL database, which wouldn't be versioned unless you went through a lot of work to do so. Aside from wp-config.php
, there aren't any other stored references of what the site's URLs should be.
Upvotes: 1