I'm new to the NodeJs and Git world, I'm trying to develop a system where users upload images.
Every time I deploy the app, the users' images are deleted from the public/uploads/ folder
How should I proceed so that people's files are not deleted in this case? I tried using .gitignore in the uploads folder, but to no avail.
I thought about hosting the images on a server separate from the server where the app is, but only if there is no other way.
I need a way to keep the public/uploads/ folder unchanged when deploying.
Note: The site is in NodeJs. Deploy is done using Git on the Openshift server.
The upload folder must be removed from the repository and inserted into .gitignore (git ignore doesn't work if the file is already in the repository)
After removing you create an empty file (I usually call it empty). This file must be forcibly inserted into the repository.
git add -f public/uploads/empty
With that only this file in the folder will be tracked. git will create the folder but it won't touch the files that are on the server.