I am developing an e-shop with Magento 2.1.x. I am using git as version control and the .gitignore file shipped with the installation of Magento 2. Now, a colleague of mine, will join the project to help developing some parts of it.

I thought that the best practice would be to install a local copy of Magento on its computer and then make a git clone to download the custom parts. Is that the correct flow? I do like this I get a lot of untracked files..

2 Answers 2


since Magento uses composer you git clone the project to you local folder and the run from the command line in the root folder

composer install

After the remaining files are installed you run:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

You can do this in two different methods.

1. Clone from your existing repository:

Before cloning you have to check what are files are not included in .gitignore file. If you want to clone the <magento_root_dir>/vendor files you can remove from .gitignore and automatically it will be cloned to the local directory. Otherwise, if you want to exclude the <magento_root_dir>/vendor files, add to .gitignore and obviously you should run the composer install command after doing this. After that, you can able to push the changes to the cloud every time when you need it.

2. Fork into the new repository:

You can create a new repository and fork from the existing repository. Then clone the files from the newly forked repository as mentioned above. Your colleague can able to push the change to the new repository and from there he/she needs to send the merge request and finally you can merge the files. So without your knowledge, nobody can able to push the files directly.

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.