New to Craft and general novice full stop. I'm not sure about the correct way to use craft and git together. I currently use BitBucket for version control and have been using ExpressionEngine... so installing Craft and understanding the proper workflow is a bit confusing to get my head around.

I installed Composer locally and ran the command to install Craft 3, but then I just ended up putting all those files into BitBucket and then connecting that with my server, I created a database and then installed Craft on the server instead of locally. I have a feeling that's the wrong way to go about it, especially after reading that I shouldn't be putting the .env file in version control (which I can't understand?? if the .env file doesn't make its way to the server how does Craft know what database, etc. to connect to?)

Can anyone tell me or point me in the right direction to how I can learn the propper/correct flow and setup?


  • I'd suggestion looking at mijingo.com and working through some tutorials.
    – 4midori
    Commented Nov 14, 2019 at 19:20

1 Answer 1


This article might be of use to you: Setting up a New Craft CMS 3 Project

The DEPLOYMENT section talks about using Composer to install our dependencies, and not checking them into Git. That means a .gitignore that excludes vendor/

This isn't really a right or wrong situation, but rather that the advantages slightly outweigh the disadvantages, imo.

If you want to see this all live in action, you can see the devMode.fm website Github repo which is an OSS example Craft CMS website that powers the devMode.fm podcast.

  • Thanks for the reply Andrew, I've just been reading through your blog post, it says about in live production put the database variables etc into your webserver config instead of using .env, what do you mean by that? Sorry if it's a dumb question. Commented Nov 14, 2019 at 1:10
  • That's a very optional thing to do; I'd stick to .env for now. More on that here: github.com/nystudio107/dotenvy Commented Nov 14, 2019 at 1:11
  • ok so stick with the .env for now, am I right in thinking, that I manually create the .env files on the server for dev, staging live and just make sure they're git ignored and not in the repository? Commented Nov 14, 2019 at 1:16
  • You are correct. Commented Nov 14, 2019 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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