缓存Github密码,之后git push 不用再输入密码

来源:互联网 发布:企业宣传制作软件下载 编辑:程序博客网 时间:2024/06/05 18:53

缓存Github密码,之后git push 不用再输入密码

0. 效果

在隔一段时间之后git push 到github,需要输入用户名和密码。
在缓存时间期限内,git push到github,就不需要再输入用户名和密码。

1. 缓存github密码

缓存15分钟(默认)

git config --global credential.helper cache

自定义缓存时间,例如1个小时

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

timeout的单位为秒。

2. 问题解决:unable to connect to cache daemon: Permission denied

问题

$ git push -u origin master fatal: unable to connect to cache daemon: Permission denied

说明缓存的github密码不允许读取。
~/.git-credential-cache/目录下保存缓存,要保证当前用户有读取.git-credential-cache目录的权限。

解决方法:
sudo chown <current-user>:<current-user> ~/.git-credential-cache

3. 参考

https://help.github.com/articles/caching-your-github-password-in-git/#platform-linux

0 0
原创粉丝点击