Instead of using git setting, you can also use environment variable (that you can set just for your session), as described in this answer:
set http_proxy=http://username:password@proxydomain:port
set https_proxy=http://username:password@proxydomain:port
set no_proxy=localhost,.my.company
So your wrapper script could, instead of modifying the .gitconfig
(and leaving your password in plain text) set environment variables on demand, just for your current session.
As noted by Welgriv, this is unsafe since environmental variables can be accessed by any program in user mode.
These days (2020, 5+ years later), I prefer:
set http_proxy=http://127.0.0.1:3128
set https_proxy=http://127.0.0.1:3128
With 127.0.0.1:3128 being the default URL for a genotrance/px
, a small HTTP proxy server, which will automatically authenticate through an NTLM proxy.
No password or even user to set.