Set Protected Environment Variables


I need to set protected environment variables in order for my Binder to run. For example, a database username and password. When running the notebook locally these variables are stored in a .env file, which I obviously don’t want to check into GitHub. Is there a way to set them in my Binder?


There is no good way to add/use secrets on This is by design and we recommend to everyone to please never type anything that is considered a secret or a password into a session on

It is a public platform where people can run arbitrary code and as a result there are lots of ways people’s credentials could get stolen. For example a notebook could ask for a password and then send it somewhere without you ever noticing. This is why the blanket advice is “please don’t type secrets into any session”.

If you really want to provide a session with secrets in it or where a set of users are comfortable typing in secrets the recommendation is that you run your own BinderHub (the software behind