背景
最近改了一下某個項目的名字,之后每次push都需要重新輸入用戶名密碼,鼓搗了半天,終于在網上找到了解決辦法。
解決方案
- 在命令行輸入命令:
git config --global credential.helper store
這一步會在用戶目錄下的.gitconfig文件最后添加:
[credential]
helper = store
- 現在push你的代碼 ,這時會讓你輸入用戶名密碼,這一步輸入的用戶名密碼會被記住,下次再push代碼時就不用輸入用戶名密碼了。
vim ~/.git-credentials
可以看到在這個文件存儲了用戶密碼。