第一步:進(jìn)入項目目錄,在 git 終端執(zhí)行以下命令:
git config --global credential.helper store
第二步:重新執(zhí)行一次git pull,這次它還是提示你輸入賬號和密碼:
git pull
Username for 'https://git.xxxxxxxx.com': ******
Password for 'https://demo123@163.com': *******
后面再 pull 或者 push 的時候,就不用輸入賬戶和密碼了。
注意,如果你換了git賬號,或者你換了電腦,執(zhí)行完 "git config --global credential.helper store" 再 "git pull"時,可能會出現(xiàn)下面的報錯:
git pull
remote: The project you were looking for could not be found.
fatal: repository 'http://git.xxxx.com/xxxx.git/' not found
解決方法是,打開“C盤/用戶”目錄,刪除該目錄下的 “.git-credentials”文件,重新執(zhí)行上面的第一步和第二步。
設(shè)置后的 .gitconfig 文件
設(shè)置后的 .git-credentials 文件文章來源:http://www.zghlxwxcb.cn/news/detail-617402.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-617402.html
到了這里,關(guān)于解決每次提交代碼都需要輸入賬號和密碼的問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!