How to configure a proxy into GitBash environment on windows 10 - python-3.x

I installed Python 3.7.3 on windows 10, but I can't install Python packages via PIP in Gitbash (Git SCM), due to my company's internet proxy.
I tryed to create environment variables for the proxy via the following, but it didn't work:
export http_proxy=''
export https_proxy=''
I found a temporary solution that works for me: inserting the following aliases into the .bashrc file:
alias python='winpty python.exe'
alias pip='pip'
The above is working but I am looking for a nicer solution so that I don't need to set aliases for every command I use. I was thinking about something like an environment variable but didn't found out how to set it up on a windows' git bash environment yet.
Do you have an idea on how to do it?

First, you don't need Git bash to pip install Python modules.
Only Git path (to use linux-like commands, plus curl, even though it is available on recent Windows 10), from a regular CMD, with a simplified PATH:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
set PH=C:\path\to\Python37
set PATH=%PH%;%PH%\Scripts
Second, you can pip install in a corporate environment, provided:
you access your proxy through px, an HTTP proxy server to automatically authenticate through an NTLM proxy
you use and trust mirror alternatives for pip module sources.
Regarding genotrance/px, simply run the service with px<port> --save --config=/path/to/your/px.ini
No need to enter your credentials (Windows log/password): the proxy uses your current login session.
Set your environment variable to reference that proxy:
set HTTP_PROXY=http://localhost:3128
set HTTPS_PROXY=http://localhost:3128
Then, this will work:
λ pip install -i --trusted-host "ansible-tower-cli==3.2.1" --force-reinstall
Looking in indexes:
Collecting ansible-tower-cli==3.2.1
Downloading (153kB)
100% |████████████████████████████████| 163kB 107kB/s
(Use any pypi mirror not blocked by your company=

first you need to check if the corp Proxy you are behind is NTLM or not, check this may help.


How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?
... or am I just being lazy?
Note: rubysspi-1.2.4 does not work.
This also works for "igem", part of the IronRuby project
I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my HTTP_PROXY environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:
I set the four referenced variables before I get to this line obviously. As an example if my username is "wolfbyte", my password is "secret" and my proxy is called "pigsy" and operates on port 8080:
SET HTTP_PROXY=http://wolfbyte:secret#pigsy:8080
You might want to be careful how you manage that because it stores your password in plain text in the machine's session but I don't think it should be too much of an issue.
For the Windows OS, I used Fiddler to work around the issue.
Install/Run Fiddler from
Run gem:
$ gem install --http-proxy http://localhost:8888 $gem_name
This totally worked:
gem install --http-proxy http://COMPANY.PROXY.ADDRESS $gem_name
I've been using cntlm ( at work. Configuration is very similar to ntlmaps.
gem install --http-proxy http://localhost:3128 _name_of_gem_
Works great, and also allows me to connect my Ubuntu box to the ISA proxy.
Check out for more information
I tried some of these solutions, and none of them worked. I finally found a solution that works for me:
gem install -p http://proxy_ip:proxy_port rails
using the -p parameter to pass the proxy. I'm using Gem version 1.9.1.
This solved my problem perfectly:
gem install -p http://proxy_ip:proxy_port compass
You might need to add your user name and password to it:
gem install -p http://[username]:[password]#proxy_ip:proxy_port compass
Create a .gemrc file (either in /etc/gemrc or ~/.gemrc or for example with chef gem in /opt/chef/embedded/etc/gemrc) containing:
http_proxy: http://proxy:3128
Then you can gem install as usual.
If you are having problems getting authenticated through your proxy, be sure to set the environment variables in exactly the format below:
set HTTP_PROXY_PASS=password
The user:password# syntax doesn't seem to work and there are also some badly named environment variables floating around on Stack Overflow and various forum posts.
Also be aware that it can take a while for your gems to start downloading. At first I thought it wasn't working but with a bit of patience they started downloading as expected.
I tried all the above solutions, however none of them worked. If you're on linux/macOS i highly suggest using tsocks over an ssh tunnel. What you need in order to get this setup working is a machine where you can log in via ssh, and in addition to that a programm called tsocks installed.
The idea here is to create a dynamic tunnel via SSH (a socks5 proxy). We then configure tsocks to use this tunnel and to start our applications, in this case:
tsocks gem install ...
or to account for rails 3.0:
tsocks bundle install
A more detailed guide can be found under:
Despite being written for Ubuntu the procedure should be applicable for all Unix based machines. An alternative to tsocks for Windows is FreeCap ( A viable SSH client on windows is called putty.
Posts abound regarding this topic, and to help others save hours of trying different solutions, here is the final result of my hours of tinkering.
The three solutions around the internet at the moment are:
rubysspi only works from a Windows machine, AFAIK, as it relies on the Win32Api library. So if you are on a Windows box trying to run through a proxy, this is the solution for you. If you are on a Linux distro, you're out of luck.
apserver seems to be a dead project. The link listed in the posts I've seen lead to 404 page on sourceforge. I search for "apserver" on sourceforge returns nothing.
The sourceforge link for cntlm that I've seen redirects to, but that times out. A search on sourceforge turns up this link, which does work:
After downloading and configuring cntlm I have managed to install a gem through the proxy, so this seems to be the best solution for Linux distros.
A workaround is to install on your local machine, configure it and run gems through this proxy.
Install: Just download apserver 097 (and not the experimental 098!) and unpack.
Configure: Edit the server.cfg file and put the values for your MS proxy in PARENT_PROXY and PARENT_PROXY_PORT. Enter the values for DOMAIN and USER. Leave PASSWORD blank (nothing after the colon) – you will be prompted when launching it.
Run apserver: cd aps097; python
Run Gems: gem install—http-proxy http://localhost:5865/ library
I am working behind a proxy and just installed SASS by downloading directly from
I then ran sudo gem install [path/to/downloaded/gem/file]. I cannot say this will work for all gems, but it may help some people.
This worked for me in a Windows box:
set HTTP_PROXY=http://server:port
set HTTP_PROXY_USER=username
set HTTP_PROXY_PASS=userparssword
set HTTPS_PROXY=http://server:port
set HTTPS_PROXY_USER=username
set HTTPS_PROXY_PASS=userpassword
I have a batch file with these lines that I use to set environment values when I need it.
The trick, in my case, was HTTPS_PROXY sets. Without them, I always got a 407 proxy authentication error.
If you are on a *nix system, use this:
export http_proxy=http://${}:${port}
export https_proxy=http://${}:${port}
and then try:
gem install ${gem_name}
rubysspi-1.3.1 worked for me on Windows 7, using the instructions from this page:
If you want to use SOCKS5 proxy, you may try rubygems-socksproxy
It works for me on OSX 10.9.3.
If behind a proxy, you can navigate to Ruby downloads, click on Download, which will download the specified update ( or Gem ) to a desired location.
Next, via Ruby command line, navigate to the downloaded location by using : pushd [directory]
eg : pushd D:\Setups
then run the following command: gem install [update name] --local
eg: gem install rubygems-update --local.
Tested on Windows 7 with Ruby update version 2.4.1.
To check use following command : ruby -v
Rather than editing batch files (which you may have to do for other Ruby gems, e.g. Bundler), it's probably better to do this once, and do it properly.
On Windows, behind my corporate proxy, all I had to do was add the HTTP_PROXY environment variable to my system.
Start -> right click Computer -> Properties
Choose "Advanced System Settings"
Click Advanced -> Environment Variables
Create a new System variable named "HTTP_PROXY", and set the Value to your proxy server
Reboot or log out and back in again
Depending on your authentication requirements, the HTTP_PROXY value can be as simple as:
Or more complex as others have pointed out

Ubuntu 16.04 apt-get - Could not resolve 'proxy_server'

Earlier, I was at my university and accessing the internet through a proxy server i.e. But, currently I am trying to run sudo apt-get update from my home internet (which as no proxy server) and I am getting the following error message.
I have removed the system and terminal proxies, and I have also removed proxies from apt.conf in /etc/apt/. What is it that's still causing the problem?
It looks like you have inherited the information from the DHCP server.
Check the APT file (you have already done it) under /etc/apt/apt.conf and remove any Acquire::XXX::proxy where XXX is http/ https / ftp
In addition to this, check /etc/environment for proxy information.
Last but not least, try to renew your DHCP information, it can eventually help: sudo dhclient -r
One last word, are you using the same BASH shell process you were using at the university or you opened a new one? Because, it could have cached information.

How to get default installation directory for IBM MQ in linux and unix?

`I have used MQ_INSTALLATION_PATH in linux
when i execute above in the path /opt/mqm/bin via root it cannot display nothing but when i execute it in the path /opt/mqm/samp/bin it displays MQ_INSTALLATION_PATH .. before i should execute crtmqenv -p command
So what a solution to get installation path of IBM MQ?
MQ v7.1 and higher support multiple installations on the same server. The command setmqenv when sourced will setup some environment variables to allow you to use a specific installation. One of the variables that is set by setmqenv is $MQ_INSTALLATION_PATH. You can display the value of this variable with the command echo $MQ_INSTALLATION_PATH.
If the installation has been setup as default using the setmqinst command, then various symlinks will be created under /usr/bin pointed back to the mq installation directory. You can display the installation directory by running the /usr/bin/dspmqver command and looking for InstPath in the output.
You can also directly call the command dspmqver -f 128 to have it return just the installation path:
InstPath: /opt/mqm
If the install is not setup as the default install and you do not know which directory MQ is installed in you can look at the /etc/opt/mqm/mqinst.ini file which will have a stanza for each installation on the server. The installation path is listed after FilePath= under each Installation stanza.
$ cat /etc/opt/mqm/mqinst.ini

Meteor update behind proxy

I tried the following command:
$ export http_proxy=url:port
(also in capital letters) + the same with https
to avoid this error :
Unable to update package catalog (are you offline?)
Nothing worked. I still have this error.
Is there someone that could help me please?
Either you didnt run meteor update after your change or your proxy requires authentication user:password.
From wiki:
Like a lot of other command-line software, the Meteor tool reads the
proxy configuration from the HTTP_PROXY and HTTPS_PROXY
environment variables (the lower case variants work, too). Examples of
running Meteor behind a proxy:
on Linux or Mac OS X
export HTTP_PROXY=http://user:password#
export HTTPS_PROXY=http://user:password#
meteor update
on Windows
SET HTTP_PROXY=http://user:password#
SET HTTPS_PROXY=http://user:password#
meteor update

How to install gem through proxy with authorization [duplicate]

This question already has an answer here:
How do I update Ruby Gems from behind a Proxy (ISA-NTLM)
18 answers
I am behind a corporate proxy and it needs authorization to use it. When I try just to use option -p, it throws error 407. Is there a workaround?
This might help you: How do I update Ruby Gems from behind a Proxy (ISA-NTLM)
this solution works for me in analog situation (corporate network behind autenticated proxy):
Create a file .gemrc under your HOME (in my case C:\Documents and Settings\my_username\.gemrc
Write inside the previous file this single line:
This is the way I figured it out. Hope it works for you too.
Fill in the proxy in your Proxy settings(varies as per your system).
Once, you are done with the proxy settings, just do (assuming a Linux system)
sudo -i gem install GEM_NAME
Note that the authorizationi.e username and password need to be filled in the proxy settings for the system.
If you are not the root user, or you wish to install the gem locally (if using RVM), don't use sudo then.