避免git clone和push時每次都需要輸入用戶名和密碼


有三種方式解決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 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM