I manage a handful of Drupal sites, one for a personal blog, and the others for local non-profit community groups. I want to start using git and GitHub as part of my workflow when upgrading/updating the sites.  I know that the standard recommendation is to use GitHub for the codebase and exclude settings.php and contributed files. That absolutely makes sense to me in a setting where there are collaborators, but it would add steps, time, and possible sources of confusion for me.

Since I would be the only person accessing my local (ddev) site, my GitHub repositories, and my production site, I would like to use git and GitHub for everything except the database.

Is this reasonable in a limited setting like mine? If not, what are the potential risks and problems?

TIA.

Peter

Comments

jaypan’s picture

It's better to not have that info out in the wild, even behind a password protected account. If someone manages to figure out a way into your site, they will screw with your site, just because they can. So if your git credentials ever got leaked or hacked, your DB passwords would be out there.

It's really not hard to keep your database settings out of settings.php. You just uncomment the text at the end of settings.php that allows for a settings.local.php file (see the code comments in that file), and then you put your DB connection info into settings.local.php, and don't commit that file to Git. That file stays on your production server, and never needs to go anywhere else.

I would always recommend this even if you're the only one working on your site.


Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
lionsea’s picture

Use Github for group works. If you are the only person who manages the websites, i.e. admin, then no need to use gits.