146 Git Bash 记住用户名密码

来源:互联网 发布:新手如何装修淘宝店铺? 编辑:程序博客网 时间:2024/05/17 23:51

git for windows (又名 msysgit)如何记住用户名和密码 : 
先创建存储用户名密码的文件 ,在home文件夹,一般是 C:\Documents and Settings\Administrator下建立文件.git-credentialswindows下不允许直接创建以.开头的文件,所以有一个小技巧:先创建一个文件名叫 )git-credentials 然后进入 git bash 使用命令:

mv git-credentials .git-credentials

用记事本打开这文件输入,如果用户名中有@,那么使用%代替:

https://{username}:{password}@github.com

例:https://xiaoerlang:654321@github.com 
保存;

进入 git bash,然后输入:

git config –global credential.helper store

执行完后去查看 C:\Documents and Settings\Administrator\.gitconfig 这个文件,发现多了一项: 
[credential] 
helper = store

就成功了。

然后要重开 git bash 窗口,再push就不用输入用户名密码


ps:如有其他库,如@git.oschina.net,则并列添加即可

0 0
原创粉丝点击