Search code examples
githerokugitignorecloud9

Git not to push/delete empty folder


I have my development environment in Cloud9 and I push to Heroku using git.
I'd like to have some folders inside Heroku environment not deleted by the deploy command.
So I've added these lines in my .gitignore file

folder/to-ignore1
folder/to-ignore2

... and so on

Then I can create content in these folders in heroku, no problem so far.
But when I try to sync my dev files again, git seems to delete these folders and its contents.
I have tryied every single variations, like

/folder/to-ignore1/
folder/to-ignore1/
/folder/to-ignore1
folder/to-ignore1
/folder/to-ignore1/*
folder/to-ignore1/*

But nothing seems to work. Every deploy I lose those files.


Obs.: I have executed the
git rm -r --cached 'files/folders'
commands as well.


Solution

  • Here is what heroku staff told me:

    (quote)

    It's worth bearing in mind that the Heroku filesystem is ephemeral - that means that any changes to the filesystem whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the filesystem from the most recent deploy.

    When you restart the application, any changes to the filesystem will be lost as new dynos will be booted. Instead of using the filesystem for persistent storage, we recommend using a database addon such as Postgres (for data) or a dedicated file storage service such as AWS S3 (for static files). If you don't want to set up an account with AWS to create an S3 bucket we also have addons here that might fit your needs https://elements.heroku.com/addons

    (end quote)

    Thanks for the attention dudes.