Already pushed commits with sensitive data? https://help.github.com/articles/remove-sensitive-data/
-
Create a config.js file.
-
Open config.js and enter your API keys.
var config = {
mapkey : '12633733456',
apikey : '56737589'
}
- Add a link to the script in your HTML file.
<script type='text/javascript' src='config.js'></script>
<script type='text/javascript' src='script.js></script>
- In your main javascript file declare the variables that point to the API keys in config.js.
var myKey = config.mapkey;
var secretKey = config.apikey;
- Create a .gitignore file. Note the period at the start of the file name:
.gitignore
- In the .gitignore file, enter the names of the files you don't want git to track.
config.js