How to keep media files inside a git ignored folder on deploy

Hello everybody!
I’ve a plugin installed on wp site (which is based on bedrock), that create a folder with user media files in the root directory (/srv/www/ . Everything works fine, but deploys. Every time i run the command “ansible-playbook deploy.yml -e “ env=staging””, all uploaded files from the folder /user-uploads/ are being removed, despite of these two lines in the .gitignore file, which, as i understand, don’t let Git to track or manipulate anything inside the specified folder:

Do anybody knows what is the problem? and how to solve that?

See as a reference if you want to get web/user-uploads shared between deploys

(But that plugin shouldn’t be writing to that folder, and should instead be writing to a subfolder in web/app/uploads/)

1 Like