https方式每次都要輸入密碼,按照如下設置即可輸入一次就不用再手輸入密碼的困擾而且又享受https帶來的極速
設置記住密碼(默認15分鍾):
git config --global credential.helper cache
如果想自己設置時間,可以這樣做:
git config credential.helper 'cache --timeout=3600'
這樣就設置一個小時之后失效
長期存儲密碼:
git config --global credential.helper store
增加遠程地址的時候帶上密碼也是可以的。(推薦)
http://yourname:password@git.oschina.net/name/project.git
補充:使用客戶端也可以存儲密碼的。
如果你正在使用ssh而且想體驗https帶來的高速,那么你可以這樣做: 切換到項目目錄下 :
cd projectfile/
移除遠程ssh方式的倉庫地址
git remote rm origin
增加https遠程倉庫地址
git remote add origin http://yourname:password@git.oschina.net/name/project.git
搞定,enjoy the speed!