缓存Git账号密码

2020-01-08大约2分钟

在电脑上进行Git操作的时候,每次从远程仓库操作,比如pullpush的时候,都需要输入密码,比较繁琐。

如果不想每次都输入密码,那么可以在命令行运行一条命令。

Windows电脑

git config --global credential.helper wincred

Mac电脑

git config --global credential.helper osxkeychain

Linux电脑

可以用这个命令:

git config --global credential.helper cache

但默认情况下,缓存密码是15分钟,可以改成更长时间,比如24个小时:

git config --global credential.helper 'cache --timeout=86400'