针对单个项目
git config credential.helper store //一直免密提交
git config credential.helper catch //临时的 默认15分钟
git config credential.helper 'cache --timeout 30000' //设置默认时间
git config credential.helper 'store --file ~/.my-credentials' //设置默认存储地址
设置后会在.git/config文件中添加
[credential]
helper = store
此时在下次提交时输入密码后,之后就不用在添加了
全局设置
在git config 后面添加--global
设置失效解决办法
如果设置后没有起作用,检查下.git-credentials文件是否自动生成,文件内是否有记录账号密码和地址。
如果没有自己添加下文件和内容
如:https://username:password@github.com
记得更换你的名字 密码 地址











网友评论