Back to Posts

Proxy config in Bash, NPM, Bower, Atom, Git & Ionic

Posted in Web-Dev, Proxy

Sometimes when you are building stuff behind huge networks like universities and corporates, you often face proxy configuration issues with many applications like NPM, Bower, Ionic, Git, Atom and Linux Bash itself. This article focuses on resolving these issues.

Linux Bash

With Authentication
1
2
3
export http_proxy='http://username:password@[Your Proxy]:[Proxy Port]/'    
export https_proxy='http://username:password@[Your Proxy]:[Proxy Port]/'
export ftp_proxy='http://username:password@[Your Proxy]:[Proxy Port]/'
Without Authentication
1
2
3
export http_proxy='http://[Your Proxy]:[Proxy Port]'    
export https_proxy='http://[Your Proxy]:[Proxy Port]'
export ftp_proxy='http://[Your Proxy]:[Proxy Port]'
View Proxy
1
env | grep -i proxy
Remove proxy
1
2
3
4
unset http_proxy
unset https_proxy
unset ftp_proxy
//these commands disable the proxy, temporarily for that particular bash session.

NPM

With Authentication
1
2
npm config set proxy "http://username:password@[Your Proxy]:[Proxy Port]/"
npm config set https-proxy "http://username:password@[Your Proxy]:[Proxy Port]/"
Without Authentication
1
2
npm config set https-proxy http://[Your Proxy]:[Proxy Port]
npm config set proxy http://[Your Proxy]:[Proxy Port]
View Proxy
1
2
npm config get https-proxy
npm config get proxy
Remove proxy
1
2
3
4
5
6
7
npm config delete https-proxy
npm config delete proxy

//or

npm config set https-proxy null
npm config set proxy null

Bower

With Authentication
1
2
3
//add the lines to `.bowerrc`
"proxy":"http://username:password@[Your Proxy]:[Proxy Port]/"
"https-proxy":"http://username:password@[Your Proxy]:[Proxy Port]/"
Without Authentication
1
2
3
// add the lines to `.bowerrc`
"proxy":"http://[Your Proxy]:[Proxy Port]"
"https-proxy":"http://[Your Proxy]:[Proxy Port]"
View Proxy
1
cat .bowerrc
Remove proxy
1
// edit and remove the lines from `.bowerrc` added earlier

Atom

With Authentication
1
2
apm config set proxy "http://username:password@[Your Proxy]:[Proxy Port]/"
apm config set https-proxy "http://username:password@[Your Proxy]:[Proxy Port]/"
Without Authentication
1
2
apm config set https-proxy http://[Your Proxy]:[Proxy Port]
apm config set proxy http://[Your Proxy]:[Proxy Port]
View Proxy
1
2
apm config get https-proxy
apm config get proxy
Remove proxy
1
2
3
4
5
6
7
apm config delete https-proxy
apm config delete proxy

//or

apm config set https-proxy null
apm config set proxy null

Git

With Authentication
1
2
git config --add http.proxy "http://username:password@[YourProxy]:[ProxyPort]/"
git config --add https.proxy "http://username:password@[YourProxy]:[ProxyPort]/"
Without Authentication
1
2
git config --add http.proxy http://[YourProxy]:[ProxyPort]
git config --add https.proxy http://[YourProxy]:[ProxyPort]
View Proxy
1
2
git config --get http.proxy
git config --get https.proxy
Remove proxy
1
2
git config --unset http.proxy
git config --unset https.proxy

Ionic

With Authentication
1
2
//You can add proxy along with the a particular serve
PROXY="http://username:password@[YourProxy]:[ProxyPort]/" ionic start [your app]
Without Authentication
1
2
//You can add proxy along with the a particular serve
PROXY=http://[Your Proxy]:[Proxy Port] ionic start [your app]

This post will be updated regularly with changes in configurations and new frameworks.

Comment below for any suggestions and framework/language requests.

Here is the Medium article for this post.

Hi, I am Diwakar, magician03 on Github and other networks. Information Technology Undergrad at Indian Institute of Information Technology Allahabad, class of 2019. Algorithms fanatic. Love to build products. Open Source Enthusiast. Ambivert. Programmer.

Share this on → Twitter Facebook Google+ Reddit
Read Next

How to host Portfolio and Blog using GitHub Pages, HarpJS