How do I deploy without changing the contents of a folder on the server?

3

I'm new to the world NodeJs and Git, I'm trying to develop from a system where users upload images.

Every time I deploy the app, users' images are deleted from the public / uploads /

How do I proceed so people's files are not deleted in this case case? I tried to use .gitignore in the uploads folder, but it did not help.

I thought of hosting the images on a server separate from the server where the app is, but only if it does not have another way.

I need a way to keep the public / uploads / folder unchanged when doing some deploy.

Note: The site is in NodeJs. Deploy is done using Git on the Openshift server.

    
asked by anonymous 19.08.2014 / 18:34

1 answer

1

The upload folder should be removed from the repository and inserted into .gitignore (git ignore does not work if the file is already in the repository)

public/uploads/*    

After removing you create an empty file (I usually call it empty). This file must be forcibly entered into the repository.

git add -f public/uploads/empty    

With this, only this file in the folder will be tracked. Git will create the folder but will not tinker with the files that are on the server.

    
03.12.2014 / 17:57