有時候git明明已經配置了用戶名和密碼,但在項目中,有時候pull和push的時候卻每次都要提示輸入用戶名和密碼,很浪費時間。
解決辦法
在git bash中輸入:
git config --global credential.helper store
執行完上面的git命令后,在命令行正常執行pull ,push,如果是在以上操作完之后第一次執行pull push,需要輸入一次用戶名密碼,以后不再需要輸入。
第一次向新的URL輸入用戶名密碼之后會發現 .git-credentials中追加了類似 https://username:password@hello.com的內容。
vim查看home路徑中的.gitconfig,會在之前
[user]
name =**********
email=***********
的基礎上多出
[credential]
helper = store