Skip to content

Instantly share code, notes, and snippets.

@SpencerDawson
Forked from rdundon/git-setup.sh
Created December 8, 2021 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpencerDawson/6cfbc7869e114fe19ad565269690d7a7 to your computer and use it in GitHub Desktop.
Save SpencerDawson/6cfbc7869e114fe19ad565269690d7a7 to your computer and use it in GitHub Desktop.
Git and Node with Zscaler proxy

Instructions

This is a fork of some scripts originally made by Craig Patik They are designed for Windows, though I'm sure they can be adjusted for *nix systems.

To use these scripts, run them as an administrator.

Also, you need to install the ZScaler SSL certificates (they are probably on your work machine if your company installed ZScaler--I exported them from Firefox), then add them to Git's SSL certificate bundle. See this answer on SO.

#!/bin/sh
# Git proxy settings
echo "Configuring Git for compatibility with ZScaler..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
#!/bin/sh
echo "Be sure to install NodeJS from http://nodejs.org before continuing"
read -p "Press enter to continue"
# NPM proxy settings
echo "Configuring NodeJS..."
mkdir /c/Users/$USERNAME/npm/
touch /c/Users/$USERNAME/npm/.npmrc
echo "proxy=http://gateway.zscaler.net:80/" >> /c/Users/$USERNAME/npm/.npmrc
# Tell NPM to use a local directory for installations and caching because user profile folders that are mapped to network shares cause many problems
mkdir /c/apps
mkdir /c/apps/npm
mkdir /c/Program\ Files/nodejs/node_modules/npm/
touch /c/Program\ Files/nodejs/node_modules/npm/.npmrc
cp /c/Program\ Files/nodejs/node_modules/npm/.npmrc /c/Program\ Files/nodejs/node_modules/npm/.npmrc.backup
echo "prefix=C:\apps\npm" > /c/Program\ Files/nodejs/node_modules/npm/.npmrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment