I have my CakePHP project which has different config content than config on server.
I used this command to create .gitignore file:
cd /var/www/html/tmc && touch .gitignore
Then I wrote this into the file:
/app/tmp/*
/app/Config/core.php
/app/Config/database.php
/vendors/*
However when I push, these files are changed again.
What have I done wrong?
Most likely, your files are already being tracked by Git, in which case Git will disregard your .gitignore
rules and commit the files anyway. If you want to make Git forget about the files you will have to git rm
them from the repository:
git rm --cached app/Config/core.php
git rm --cached app/Config/database.php
and so on for all the files you want to ignore.
After running these commands your working tree should have changes corresponding to the removes you have done. After you commit and push, the files will no longer be tracked.