每次進行將本地代碼提交到遠程的時候總會要求輸入賬號和密碼: git push origin master
輸入賬號和密碼,明明是對的,卻提示登陸失敗: Logon failed, use ctrl+c to cancel basic credential prompt.
會彈出個登陸框:是因為是執行過: git config --global credential.helper manager
這個指令。
可以通過: git config --list來查看:
使用 git config --system --unset credential.helper
,或者 git config --global --unset credential.helper
我在git base上執行完這個,這個登陸框就不彈出來了。
如果還是不行,你就要再看下上述的credential.helper=manager是不是還是存在,如果還是存在,你可能設置到全局了,那么執行:
git config --global --unset credential.helper。總之,只要是還存在的話,就要想辦法將它去掉。
解決了登陸框彈出的問題,接下來解決每次都要輸入密碼的問題:執行 git config --global credential.helper store (這個指令執行后,會要求第一次輸入密碼,然后賬號和密碼會被緩存到.git-credentials文件中,后續就不用再輸入賬號密碼了)
繼續查看: git config --list
發現:manager那個也已經不存在了,變成了store,你查看下你的用戶目錄下是不是有個.git-credentials文件,同時存了你的賬號和密碼。