Multiple CircleCI Projects for Single Repo

I would like to different environment variables for different branches of my project. I do not want to set the environment variables in my circle.yml file or in a bash script, as that would violate the best practice of separating config variables from code.

I know that you can set environment variables in Circle CI’s Build Settings -> Environment Variables menu. However, it looks like you can only have one set of build settings per project. For that reason, I’d like to have multiple Circle CI “projects” for a single repo. Is that possible?

This question has been asked before but there was no response and the thread was closed for inactivity. A potential work around is to store the environment variables as API_KEY_PROD and API_KEY_STAGING, and have the bash script pull from those values based on branch. However, I’d like to avoid that if possible.


IMO, the config variables should go into another repo. “Configuration as code” is good because it is repeatable and can be rolled back as required.

Thus, you could create a repo that associates branch names with source files. In your build process, after you have checked out your main project, also clone your config repo, and source the env var set based on the branch variable.

Have you looked at context

I use this to have the same enviroment variable name with different values available to different branches (contexts) withing the same repo

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.