KING 博主等级

一帆风顺 ⛵️⛵️⛵️

如何让Git记住用户名和密码

钟晓川
2023-06-20 / 10 点赞 / 471 阅读

永久记住密码

git config --global credential.helper store

会在用户主目录的.gitconfig文件中生成下面的配置

[credential]
helper = store

如果没有--global,则在当前项目下的.git/config文件中添加
当然,你也可以直接复制上面生成的配置到配置文件中

临时记住密码
默认记住15分钟:

git config –global credential.helper cache

下面是自定义配置记住1小时

git config credential.helper ‘cache –timeout=3600’
10