Git for windows (又名 msysgit)如何記住用戶名和密碼 : 先創建存儲用戶名密碼的文件 ,在home文件夾,一般是C:\Documents and Settings\Administrator
下建立文件git-credentials
(windows下不允許直接創建以.開頭的文件,所以有一個小技巧:先創建一個文件名叫 )git-credentials
然后進入 git bash,使用命令:
mv git-credentials .git-credentials
用記事本打開這文件輸入,如果用戶名中有@,那么使用%代替:
例: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就不用輸入用戶名密碼