git http方式時保存密碼


 

一直使用ssh方式,但是git@osc的ssh只能pull,不能push  - -|||    htts方式保存密碼老是忘記,每次提交代碼都要輸入密碼煩死了。找到文章備忘:

轉自:http://git.oschina.net/oschina/git-osc/issues/2586

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!

copy from:https://www.cnblogs.com/radio/p/4253331.html


免責聲明!

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



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