1、设置记住密码(默认15分钟):
git config --global credential.helper cache
2、如果想自己设置时间,可以这样做:
git config credential.helper ‘cache --timeout=3600’
这样就设置一个小时之后失效
3、长期存储密码:
git config --global credential.helper store
4、增加远程地址的时候带上密码也是可以的。(推荐)
http://yourname:password@git.oschina.net/name/project.git
5、如果push遇到在输入密码是熟错后,就会报这个错误fatal: Authentication failed for
解决办法:
git config --system --unset credential.helper
之后你在push就会提示输入名称和密码
6.https方式每次都要输入密码,按照如下设置即可输入一次就可以很长时间不用再手输入密码。
首先执行下面的命令(如果不执行下面的命令,可能会导致设置无效)
git config --global user.email “你的git的注册邮箱”
git config --global user.user"你的git用户名"