0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

2 Answers2

2

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.

1

Git itself should not delete untracked folder.

It only does so if there is a git clean -fd executed, as in this heroku Rakefile

Cloud9 list Heroku in its "Deploying via the Command Line" and refers to the Heroku documentation. Check during the deployment process if there are any other commands (like some post-receive hook) executed which might explain the "cleanup" done to your remote workspace.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sorry, I did not understand. What should I do to make it stop? Because I kinda know it should not be doing that, but I need it to stop. – Jean Carlos Racoski Jan 10 '17 at 10:53
  • My deploy process is made by these three commands: git add . git commit -am "commit-name" git push heroku master – Jean Carlos Racoski Jan 10 '17 at 11:08
  • I have used the command git status --ignored to see if my folders were being ignored and they are indeed. – Jean Carlos Racoski Jan 10 '17 at 11:28
  • @JeanCarlosRacoski to check if a file within a folder is ignored: `git check-ignore -v -- afile` – VonC Jan 10 '17 at 12:32
  • 1
    @JeanCarlosRacoski The fact that a folder/file is ignored locally has no effect on the destination (where an heroku push might clean the desitnation workspace) – VonC Jan 10 '17 at 12:33