問(wèn)題描述
在服務(wù)器上每次執(zhí)行g(shù)it pull反肋,都提示輸入用戶名和密碼
現(xiàn)象分析
我們?cè)趃it clone工程時(shí)有2中形式 https
和git@git
。當(dāng)你使用前者拉取工程時(shí)每次都需要輸入用戶名和密碼
解決方案
1.執(zhí)行下面命令
git config --global credential.helper store
這個(gè)時(shí)候~/.gitconfig文件中會(huì)多一行
[credential]
helper = store
2.執(zhí)行g(shù)it pull再次輸入用戶名和密碼
此時(shí)你會(huì)看到/root/.git-credentials
中會(huì)多一行內(nèi)容彤悔。里面的內(nèi)容類(lèi)似https://{username}:{password}@github.com
這種形式