death
October 17, 2020, 9:23am
1
Hi,
In my ReactJS project, I am trying to use a dependency directly from a private GitHub repository. This was very helpful and I was able to use the dependency.
The problem is that I can’t use the credential using an environment variable.
npm install git+https://${GIT_TOKEN}:x-oauth-basic@github.com/user/repo.git
The ${GIT_TOKEN}
is parsed as a string.
I tried to echo the value in pre:install
and it worked there but not during the build.
Will I have to create my own build script/process? If yes, is there any guide or something?
Thanks
perry
October 19, 2020, 8:14pm
2
hmm, not 100% sure this is quite the right thing, but maybe start here?
Last reviewed: August 2023
The preferred way to use environment variables in Netlify is to set them in our environment - be that in the Environment Variables settings UI (on the site’s “Build & Deploy settings” page), or via netlify.toml . You’ll want to choose the right pattern to meet your needs. Setting variables in our UI may be considered a bit more secure, since only people with access to the Netlify admin UI for your site can see them, rather than “anyone who can clone your repo!”.
Thes…