I'm having a very strange issue and I wish to know your advice on this please.
Sometimes, when I push changes to REMOTE server, the changes don't appear.
I do ssh to the remote machine, I do a git status, and I see:
modified: app/runtime/application.log
The thing is, all directory, and now also, specific files there, are being targeted by .gitignore .
/nbproject/
/app/runtime/
/public_html/assets/
/app/runtime/application.log*
/app/runtime/error.log*
No ftp as being done directly, only push and pull has been used.
Maybe they are things written to app/runtime/application.log on the live site, so the application.log is different from the one in the repository, and when that happens git refuses to pull, because it will then overwrite application.log to an older version.
This may happen to a number of other files on that same directory. Files that could be created by the live site, the moment the application runs.
My question is, how can we avoid this? Why .gitignore seems to NOT be effective here?
ps - If I need to provide some more details, like server hooks or something, please let me know.
Sounds like you added app/runtime/application.log to git before applying the .gitignore rules. gitignore doesn't affect git's awareness of existing files, only newly created ones.
git rm --cached app/runtime/* should remove the logs from git's index.
From man gitignore:
A gitignore file specifies intentionally untracked files that git should ignore. Files already tracked by git are not affected.
So, if your application.log file is added to the repository, then gitignore will do nothing.
The solution would be to remove these files from the repository. Do you really need to synchronize the log files?
git rm --cached app/runtime/application.log
And so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With