Michail N
Michail N

Reputation: 3835

Setting git proxy's without security compromise

I want to set my proxy to use with git. I know that I can use

git config --global http.https://domain.com.proxy http://proxyUsername:[email protected]:port

git config --global http.https://domain.com.sslVerify false

My problem is that I don't want to expose the password of my user in the proxy server. This is a security problem as someone can search through my history and see the command (this a common machine). Is there a way to execute this command without exposing my password? I was thinking also to clean my bash history with something like

cat /dev/null > ~/.bash_history && history -c 

but is this enough to protect my password?

Upvotes: 1

Views: 45

Answers (1)

Arkadiusz Drabczyk
Arkadiusz Drabczyk

Reputation: 12373

In bash you can set HISTCONTROL=ignorespace and prepend your git commit with a whitespace. From man bash:

HISTCONTROL
              A colon-separated list of values controlling how commands are saved on the
              history list.  If the list of values  includes  ignorespace,  lines  which
              begin  with  a space character are not saved in the
              history list.

You might already have HISTCONTROL set to a sane value, check it:

$ echo $HISTCONTROL
ignoreboth

ignoreboth is a shortcut for ignorespace and ignoredups.

BTW, are you sure that nobody can read your ~/.gitconfig?

Upvotes: 1

Related Questions