DEV Community

Discussion on: How to hide API KEY in GitHub repo

Collapse
 
jaagrav profile image
Jaagrav

Let's say I am using netlify functions, and I made the repo public on Github, is there any way to hide my APIs, because I don't want to make my repo private.

Collapse
 
ptprashanttripathi profile image
Pt. Prashant tripathi

Use .env varibal and add .env in .gitignore file

Thread Thread
 
jaagrav profile image
Jaagrav • Edited

But what the website and the functions are fed directly from the github repo to Netlify... Will it still work in that case?

Thread Thread
 
ptprashanttripathi profile image
Pt. Prashant tripathi

Yes you just have to setup environment variables in netlify Also
To do so read official documentation

👉 Netlify Docs📗