$ git config --global user.name "John Doe"$ git config --global user.email [email protected]


在GitBash中 输入 git config --global credential.helper store 
执行完后去查看 %HOME%\.gitconfig 这个文件,发现多了一项: 
[credential] 
helper = store 



1. 创建存储用户名密码的文件 
在home文件夹 (Windows 直接 win + R 然后输入"%HOME%" 回车),新建名为 _netrc的文件, 里面的内容是: 

machine github.com
login [email protected]
password 102030


2. 新建名字是  .git-credentials的文件
(如果是 windows请注意, win 下不允许直接创建以 . 开头的文件,所以先创建一个文件名叫 git-credentials 的文件)
然后在gitbash / 命令行 cd 到%HOME%这个目录, 执行: 

mv git-credentials .git-credentials 

用记事本打开这文件输入,如果用户名中有@,那么使用%代替: 


https://{username}:{password}@github.com 

比如: 
https://zhangsan%ucgit.com:[email protected] 
保存 


3. 在GitBash中 输入 git config --global credential.helper store 
执行完后去查看 %HOME%\.gitconfig 这个文件,发现多了一项: 
[credential] 
helper = store 


三个文件如下

Git , TortoiseGit 操作记住密码

重新打开bash 或者使用tortoiseGit就不需要输入用户名密码了

相关文章:

  • 2021-12-13
  • 2021-08-15
  • 2022-02-01
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2022-02-22
  • 2021-09-30
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案