問題描述
執(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方式每次都要輸入密碼,按照如下設置即可輸入一次就不用再手輸入密碼的困擾而且又享受https帶來的極速
設置記住密碼(默認15分鐘):
git config --global credential.helper cache
如果想自己設置時間繁成,可以這樣做:
git config credential.helper 'cache --timeout=3600'
這樣就設置一個小時之后失效
長期存儲密碼:
git config --global credential.helper store
解決方案
1.http://username:password@git.coding.net/name/project.git 這樣就可以讓當前操作以輸入的用戶名和密碼登錄
2.運行命令:rm ~/.git-credentials吓笙,刪掉git config --global credential.helper store保存的賬號和密碼∑蛹瑁回到每次輸入用戶名和密碼观蓄。
原文:http://www.cnblogs.com/jarvisjin/p/5915419.html