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 窗口,再操做就不用輸入用戶名密碼了