Skip to content

Instantly share code, notes, and snippets.

@rdundon
Forked from patik/git-setup.sh
Last active June 9, 2024 19:58
Show Gist options
  • Save rdundon/ceb2481aea727d50d674b7d485c72e7a to your computer and use it in GitHub Desktop.
Save rdundon/ceb2481aea727d50d674b7d485c72e7a 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
@rdundon
Copy link
Author

rdundon commented Jan 6, 2020

I am a bit confused since npm stores the certificates inside itself. Did you add something to npmrc config file to set some custom ca bundle?

Bit of a late response, but I honestly don't recall. I also don't work at that employer anymore, so I wouldn't be able to test.

If you think a step is missing, feel free to fork/modify it!

@Erutan409
Copy link

I hope you don't mind me dropping this comment to remind me where I found this.

Thank you, BTW.

@SpencerDawson
Copy link

use https://ip.zscaler.com/ to determine if you are on a different gateway as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment