1. 程式人生 > >解決`向github提交程式碼是老要輸入使用者名稱密碼`的問題 (試了一下,靠譜)

解決`向github提交程式碼是老要輸入使用者名稱密碼`的問題 (試了一下,靠譜)

在命令列輸入命令: git config --global credential.helper store ☞ 這一步會在使用者目錄下的.gitconfig檔案最後新增:

 [credential]      helper = store 現在push你的程式碼 (git push), 這時會讓你輸入使用者名稱密碼, 這一步輸入的使用者名稱密碼會被記住, 下次再push程式碼時就不用輸入使用者名稱密碼啦! ☞這一步會在使用者目錄下生成檔案.git-credential記錄使用者名稱密碼的資訊.

☞ git config --global 命令實際上在操作使用者目錄下的.gitconfig檔案, 我們cat一下此檔案(cat .gitconfig), 其內容如下:

[user]  name = alice  email = [email protected] [push]  default = simple [credential]  helper = store git config --global user.email "[email protected]" 操作的就是上面的email git config --global push.default matching 操作的就是上面的push段中的default欄位 git config --global credential.helper store 操作的就是上面最後一行的值