文章出處
文章列表
ssh到服務器上,原來基于public/private key pair的方法不好使了。
1.1 創建文件存儲GIT用戶名和密碼
在%HOME%目錄中,一般為C:\users\Administrator,也可以是你自己創建的系統用戶名目錄,反正都在C:\users\中。文件名為.git-credentials,由于在Window中不允許直接創建以"."開頭的文件,所以需要借助git bash進行,打開git bash客戶端,進行%HOME%目錄,然后用touch創建文件 .git-credentials, 用vim編輯此文件,輸入內容格式:
https://{username}:{password}@github.com
1.2 添加Git Config 內容
進入git bash終端, 輸入如下命令git config --global credential.helper store
執行完后查看%HOME%目錄下的.gitconfig文件,會多了一項:
[credential]
helper = store
重新開啟git bash會發現git push時不用再輸入用戶名和密碼
文章列表
全站熱搜