問題描述
執(zhí)行 git clone [url]
操作結(jié)果如下:
Cloning into 'git'...
remote: Coding.net Tips : [Permission denied!]
fatal: unable to access 'https://git.coding.net/xxxxx/git/': The requested URL returned error: 403
問題起因
git緩存了錯誤的賬號和密碼.
https方式每次都要輸入密碼,按照如下設(shè)置即可輸入一次就不用再手輸入密碼的困擾而且又享受https帶來的極速
設(shè)置記住密碼(默認(rèn)15分鐘):
git config --global credential.helper cache
如果想自己設(shè)置時間,可以這樣做:
git config credential.helper 'cache --timeout=3600'
這樣就設(shè)置一個小時之后失效
長期存儲密碼:
git config --global credential.helper store
解決方案
1.http://username:password@git.coding.net/name/project.git 這樣就可以讓當(dāng)前操作以輸入的用戶名和密碼登錄
2.運(yùn)行命令:rm ~/.git-credentials,刪掉git config --global credential.helper store保存的賬號和密碼。回到每次輸入用戶名和密碼。
原文:http://www.cnblogs.com/jarvisjin/p/5915419.html