有三種方式解決git clone時每次都需要輸入用戶名和密碼,
1. SSH免密方式
使用git bash ssh-keygen或puttygen.exe生成公鑰。
2. 配置全局開機存儲認證信息
下面命令會將下次彈框的賬號和密碼保存起來,永久使用。
git config --global credential.helper store
如果想要清除該賬號和密碼,使用如下命令:
git config --global credential.helper reset
想要臨時存儲(默認15min),使用如下命令
git config --global credential.helper cache
windows下的臨時存儲命令不是上面的,應該使用下面的命令
git config --global credential.helper wincred
3. 地址中攜帶用戶信息
在https鏈接里加入username:password。
git remote add origin https://username:password@xxx.git