轉(zhuǎn)自:https://my.oschina.net/u/2552286/blog/1518334
git 每次都要求輸入username和password
git config --global credential.helper store
但是設(shè)置了之后會報(bào)"fatal unable to get credential storage lock File exists"
刪除 C:\Users\Administrator.git-credentials.lock 的文件
轉(zhuǎn)自:http://www.reibang.com/p/8a015684f3e1
問題
今天在提交git項(xiàng)目時遇到提示:fatal: unable to get credential storage lock: File exists娇未。
但是似乎提交依然成功了,不知道這個報(bào)錯有什么影響灌诅。
原因
git config --list 發(fā)現(xiàn)
git的config中credential.helper項(xiàng)有重復(fù)速址,我的是同時含有credential.helper=store
和credential.helper=manager
解決辦法
在git的config中找到credential.helper項(xiàng),刪除其中一項(xiàng)材蛛。
- 首先要確定是否是有config中credential.helper重復(fù)引起的問題太伊,執(zhí)行
git config -l
可查看所有參數(shù) - 確定參數(shù)配置的位置妻怎。分別執(zhí)行
git config --local -l
git config --global -l
-
git config --system -l
可查看當(dāng)前項(xiàng)目刁赖、全局搁痛、系統(tǒng)的參數(shù),找到credential.helper=manager
的那一項(xiàng)
- 如果是在系統(tǒng)參數(shù)中宇弛,則執(zhí)行
git config --system --unset credential.helper
即可刪除system中的此參數(shù)配置鸡典。如果是在local或global則將其中的system替換即可。 - 如果依然有問題枪芒,可嘗試升級Git版本到2.9.0以上并再次修改config彻况。
補(bǔ)充說明
除了使用指令修改config外也可直接找到配置文件修改。
在win中病苗,git的config配置文件路徑分別為:
- local:在當(dāng)前項(xiàng)目的.git/config文件中疗垛,默認(rèn).git是隱藏文件
- global:在
%HOME%/.gitconfig
中,%HOME%
為系統(tǒng)自帶環(huán)境變量硫朦,一般為C:\Users\<username>
,相當(dāng)與linux的~贷腕。另外.gitconfig
文件可能也是隱藏的 - system:在git安裝目錄的
mingw64\etc\gitconfig
文件中
在linux中,git的config配置文件路徑分別為:
- local:也是在當(dāng)前項(xiàng)目的.git/config文件中
- global:在/.gitconfig中咬展,為當(dāng)前用戶的主目錄
- system:在根目錄
/etc/gitconfig
文件中
參考
Stackoverflow--fatal: unable to get credential storage lock: File exists
Github--Can't deal with lock file .git-credentials.lock when exec git push in v2.8.3
作者:zgjx
鏈接:http://www.reibang.com/p/8a015684f3e1
來源:簡書
著作權(quán)歸作者所有泽裳。商業(yè)轉(zhuǎn)載請聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請注明出處破婆。