Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keep config file on heroku but remove from public repo on github?

Tags:

github

heroku

I am trying out newrelic on a test app which is deployed to heroku.

I have both remotes origin(the public github repo) and heroku.

After pushing to heroku with the newrelic.yml file included, I would like to be able to push changes back to origin but not include the newrelic.yml file because it contains a license_key.

I tried putting config/newrelic.yml in .gitignore but it still tracks the file and pushes the file to origin. Then I tried deleting the file but can't get a clean "git status".

I tried rm config/newrelic.yml but then even with it in .gitignore the next time I push to heroku it removes the file on heroku causing newrelic monitoring to stop.

I saw other similar issues on SO with answers referring to heroku config vars https://devcenter.heroku.com/articles/config-vars but don't understand how this relates if it does, to removing the config file for github.

Thanks

like image 874
isimmons Avatar asked Sep 27 '13 23:09

isimmons


1 Answers

Heroku take all your files from Github, each push replace all your files by the new ones. I don't think you can do something like this.

If you put your file in the .gitignore, you won't be able to push it to Heroku.

A solution may be to use branch on Github, on the master you keep your code without the config file, and on the branch "Heroku", you add the file and use it to do the push on Heroku.

like image 101
Erowlin Avatar answered Sep 28 '22 20:09

Erowlin