https方式每次都要輸入密碼,按照如下設定即可輸入一次就不用再手輸入密碼的困擾而且又享受https帶來的極速
設定記住密碼(預設15分鐘):
git config --global credential.helper cache
如果想自己設定失效時間,可以這樣做:
git config credential.helper 'cache --timeout=3600'
這樣就設定一個小時之後失效
長期存儲密碼:
git config --global credential.helper store
或者遠端位址帶上密碼
1 | |
補充:使用用戶端也可以存儲密碼的。
如果你正在使用ssh而且想體驗https帶來的高速,那麼你可以這樣做: 切換到項目目錄下 :
cd projectfile/
移除遠端ssh方式的倉庫位址
git remote rm origin
增加https遠端倉庫位址
git remote add origin
搞定,enjoy the speed!