https 方式每次都要輸入密碼,按照如下設置即可輸入一次就不用再手輸入密碼的困擾而且又享受 https 帶來的極速
按照以下設置記住密碼十五分鍾:
git config --global credential.helper cache
如果你想自定義記住的時間,可以這樣:
git config credential.helper 'cache --timeout=3600' //這里記住的是一個小時,如需其他時間,請修改3600為你想修改的時間,單位是秒
你也可以設置長期記住密碼:
git config --global credential.helper store
或修改倉庫的地址帶上你的賬號密碼
http://yourname:password@git.oschina.net/name/project.git //注意,碼雲平台同時支持個性地址與郵箱,當使用郵箱時,請對@符號使用%40替換
如果你原本使用的 ssh 地址想更換成 http(s) 地址,可以執行以下命令:
//刪除原本的ssh倉庫地址 git remote rm origin //origin 代表你原本ssh地址的倉庫的別名 //新增http地址的倉庫 git remote add origin http://git.oschina.net/username/project.git