在git下面经常干活的话老是要输密码,比较烦
之前查了一下而且问了下别人
据说直接输入命令就可以了(Git手册-Credential cache)
$ git config credential.helper cache
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
但是我试了试发现不太行
于是中间放弃治疗了一段时间
不得不说输密码真的很烦...
后来查别的git命令的时候在stackoverflow上无意中看到另外一个方法:修改配置文件
在Home目录下进行以下操作:(在我的Win7里 Home路径就是C:\Users\Lirian\)
在.gitconfig文件中加上(如果没有则新建)
[credential]
helper = store
这么一行
然后再新建一个.git-credentials文件,内容为
https://LKI:myPassword@github.com
https://lllki:myPassword@sjtu.edu.cn
只要正确设置了用户名密码和域名
以后就不用每次都一遍遍地输密码啦~\(≧▽≦)/~
tips:Windows不允许直接建立文件名以.开头的文件
不知道怎么建的话可以去搜索一下