7

I've deployed an app to Heroku, and I'm currently storing my environment variables in an .env file. I used heroku config:push to push the variables up to heroku, and that worked fine.

Now, I want to update one of them. I changed it in my .env file, and ran heroku config:push again. The push said it was successful, but when I run heroku config, I can see that the values actually haven't changed. I've tried running heroku restart, but that didn't do anything.

How can I update my environment variables in heroku?

Andrew
  • 2,425
  • 2
  • 24
  • 35

1 Answers1

17

Figured it out. You need to run heroku config:push --overwrite because it won't overwrite existing variables by default. This is poorly documented :-/

Andrew
  • 2,425
  • 2
  • 24
  • 35
  • +1 for poor documentation by heroku. https://devcenter.heroku.com/articles/config-vars#local-setup clearly states that you need to use --overwrite when pulling variables but not when pushing. – liquidki Aug 07 '14 at 21:35
  • 3
    `heroku config:push --overwrite` doesn't seem to be working for me. It still shows the older configuration when I do `heroku config` – Pratik Mandrekar Aug 20 '14 at 13:56
  • 1
    It worked for me. But I noticed problems with spaces or quotes in the definition of my variables in .env. It seems you should not use any spaces or quotes, which makes it very hard to read – morgler Feb 07 '15 at 15:42
  • 1
    @morgler I also found out single quotes are different than double quotes. – Rob Osborne Nov 22 '15 at 22:12
  • is this still true today ? – Gel Aug 29 '22 at 12:24