代码之家  ›  专栏  ›  技术社区  ›  Michail N

在不影响安全的情况下设置git代理

  •  1
  • Michail N  · 技术社区  · 6 年前

    我想将我的代理设置为与git一起使用。我知道我可以用

    git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
    
    git config --global http.https://domain.com.sslVerify false
    

    我的问题是我不想在代理服务器中公开我用户的密码。这是一个安全问题,因为有人可以搜索我的历史,并看到命令(这是一个普通的机器)。有没有办法在不暴露密码的情况下执行此命令?我还想用一些东西来清理我的狂欢史

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

    但这足以保护我的密码吗?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Arkadiusz Drabczyk    6 年前

    bash 你可以设定 HISTCONTROL=ignorespace 准备好你的 git 用空白提交。从 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.
    

    你可能已经 HISTCONTROL 设置为正常值,检查它:

    $ echo $HISTCONTROL
    ignoreboth
    

    ignoreboth ignorespace ignoredups .

    顺便问一句,你确定没有人能读懂你的 ~/.gitconfig ?