I have simple html+css+js web setup and I would like to host it on github publicly, but I am using a third party api, so how can I hide the api key of same on github repo. Can someone help me out?
Asked
Active
Viewed 601 times
0
-
you can use this this https://www.npmjs.com/package/dotenv – nitin May 03 '20 at 06:32
-
you can't hide it on github, if it's on github (public repo) then it's public by definition – Jaromanda X May 03 '20 at 06:33
-
Check out this [thread](https://stackoverflow.com/questions/53648652/how-to-use-environment-variables-in-github-page) on a somewhat similar case. – mburii_ya_mwitu May 03 '20 at 06:44
1 Answers
2
There are several ways to do this. If you just want to hide it from git repo, i create another api key file and store my api like this
export const apikey= '12341234123'
after that I just add it to the gitignore folder.
If you don't know what the gitignore folder is or how to create it, it is pretty straight forward. Here is a guide: How to create a .gitignore file

James
- 341
- 3
- 8