Git使用技巧

tip1 保存Git用户名与密码

在windows下面,我们获取项目的时候经常会提示要求输入用户名与密码,特别烦。可以通过简单的设置即可保存用户与密码

  • 设置配置文件
    C\Documents and Settings\<user>\.gitconfig 文件或 项目/.git/config 文件里增加两行

    [credential]  
      helper = store
    
  • 查看效果
    下次git操作按照提示输入用户名与密码,相关信息就会存储在C:\Documents and Settings\Administrator\.git-credentials ,效果如下

    https://username:[email protected]  
    https://username:[email protected]