Owen Conti

Copying Heroku Environment Variables Across Projects

Posted on under Devops by Owen Conti.

This article assumes you have the Heroku CLI installed and setup.

Copying Heroku config to local file

Using the Heroku CLI you can copy all of the config variables out of a project into a local file:

1heroku config -s -a {PROJECT_NAME} > config.txt

Setting values from local file into Heroku project

You can also do the opposite, push config values into a Heroku project:

1cat config.txt | tr '\n' ' ' | xargs heroku config:set -a {PROJECT}

Thanks for reading this article!

Hopefully you found this article useful! If you did, share it on Twitter!

Found an issue with the article? Submit your edits against the repository.