Skip to content

Instantly share code, notes, and snippets.

@jdmonty
Forked from rdundon/git-setup.sh
Created November 22, 2023 16:17
Show Gist options
  • Save jdmonty/eb5b8af8458f575a10a9cf895a2b10fd to your computer and use it in GitHub Desktop.
Save jdmonty/eb5b8af8458f575a10a9cf895a2b10fd 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