In my Git repository, for security reasons, I do not have the .env file; however, in the production environment, this file already exists at the root and is configured (and it's not versioned). My goal is that when I deploy to Cloudways, this production file is retained, and I don't have to reconfigure it again with each deployment.
However, when I perform the pull via Cloudways, this production file gets deleted. How can I prevent Git from deleting it?
In such cases, I prefer to keep the "to be retained" files in a different folder - and as part of your deployment process, you can create symbolic links once the code has been deployed into appropriate folders. For eg (concept-wise), this is how capistrano manages different releases.
In the above example, your file (that should not change across releases) can go into the
sharedfolder.