2

Please excuse this newbie question (newbie to Git that is). I'm trying to set up my CraftCMS environments with Git and wonder about best practices and how others configure your repositories.

In specific, do you have separate Git repos for separate sites, or is it all in one big repo? Do you have separate repos for the outward-facing portion of a single Craft site and its application files or is that all in one repo?

Thank you in advance.

5

Each project should be a separate repository, definitely. After that - feel free to include what you like. Personally I follow something like this and ignore my /app folder: https://deploybot.com/guides/deploy-craft-cms-to-digitalocean. But you could also include the /app directory and plugins.

Also: Git Workflow and Multi Environment - how to approach

And: https://craftcms.com/support/craft-storage-gitignore

  • Thanks, @darylknight. I would definitely want to include config files (other than config/db.php) and templates, plugins. I wonder how to create that in one repository together with the outward-facing portion of the site, as they reside in different areas of the directory. How would I run a 'git init' in both directories at once? Thanks again. – userAW Feb 2 '17 at 15:34
  • My git root is on the same level as /craft and /public. So on your local machine you'd have /sites/domain.dev/ - then /public and /craft inside that folder, which is where your git root is – darylknight Feb 3 '17 at 10:29
  • ok, it sounds like I'll have to think about it a little more. i have a general public folder that houses multiple sites and a general craft folder that houses corresponding apps folders for those sites. these are all development sites and sharing the same base url (but completely separate craft installs/cps,etc). since you suggest having separate git repos per project, this wouldn't work with my current configuration. thanks for your help-- definitely enough information to get me thinking. – userAW Feb 3 '17 at 13:11
  • 1
    Yeah... you should change that. You need a separate folder for each website. – darylknight Feb 6 '17 at 9:44
  • We ended up going with a separate folder for each site, as @darylknight suggests. We have been using this setup for 1 1/2 years and everything works very well. Thanks! – userAW Aug 29 '18 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.