git保存密碼

https方式每次都要輸入密碼,按照以下設置便可輸入一次就不用再手輸入密碼的困擾並且又享受https帶來的極速git

設置記住密碼(默認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.gitssh

相關文章
相關標籤/搜索