Git记住用户名和密码

最近重装了电脑,发现每次提交代码到远程仓库时都要输入用户名和密码。

解决方案
GIT有两种方式记住用户名和密码

永久记住密码

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’

不过这个我们一般是不用的。

原文链接:https://blog.csdn.net/guzhao593/article/details/8531177


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注