Windows7的Git Bash設置密碼緩存 (cache credential)

在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:[email protected]
https://lllki:[email protected]
只要正確設置了用戶名密碼和域名

以後就不用每次都一遍遍地輸密碼啦~\(≧▽≦)/~



tips:Windows不允許直接建立文件名以.開頭的文件

不知道怎麼建的話可以去搜索一下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章