Windows下使用git bash时,老是提示输入用户名密码,严重影响了开发效率,经搜索查找找到了以下有效的解决方案,屡试不爽!git
一、先建立存储用户名密码的文件 ,在home
文件夹,通常是 C:\Documents and Settings\Administrator
下创建文件.git-credentials
(windows
下不容许直接建立以.开头的文件,因此有一个小技巧:先建立一个文件名叫 )git-credentials
而后进入 git bash
使用命令:github
mv git-credentials .git-credentialswindows
二、用记事本打开这文件输入,若是用户名中有@,那么使用%代替:bash
https://{username}:{password}@github.comcode
例:https://xiaoerlang:654321@github.com
保存;开发
三、从新进入 git bash,而后输入:it
git config –global credential.helper store效率
执行完后去查看 C:\Documents and Settings\Administrator\.gitconfig
这个文件,发现多了一项:
[credential]
erlang
helper = store
就成功了。搜索
四、而后要从新打开 git bash 窗口,再操做就不用输入用户名密码了