Git 密码存储

git(终端、SourceTree)每次clone/pull/push都要输入密码真的很反锁,下面我就来看看将密码存储起来的方法。

方式一、设置记住密码(默认15分钟)

git config --global credential.helper cache

方式二、自己设置时间(这里设置15分钟---60*15=900s)

git config credential.helper 'cache --timeout=900'

方式三、长期存储密码

git config --global credential.helper store

设置后查看git配置文件 

git config --lis

发现 多了一项 红框内容

问题:如果以上都设置完成后 push 仍然提示passphrase for key '/Users/baidu/.ssh/id_rsa'需要输入密码。

解决:终端 命令 ssh-keygen -p  之后会有多步提示,当提示Enter old passphrase: 时输入电脑密码,其它提示均输入enter键即可。

参考:https://stackoverflow.com/questions/21095054/ssh-key-still-asking-for-password-and-passphrase#comment36834166_21095345

到此就设置完成!请多多指教。

猜你喜欢

转载自blog.csdn.net/haifangnihao/article/details/89636386