HTTP/HTTPS
Linux
在Linux環(huán)境下使用http/https協(xié)議clone/pull GitLab倉庫的代碼遇到這個(gè)問題。以下解決方案也適合GitHub或其他倉庫如碼云,coding。
解決方案:
-
在home目錄下創(chuàng)建
.git-credentials
文件vim .git-credentials
,輸入形如https://{username}:{password}@github.com
的配置文本:http://root:1qazroot@192.168.20.149/8090
若有多個(gè),一行一個(gè),:wq
保存退出 -
執(zhí)行命令:
git config --global credential.helper store
-
執(zhí)行命令:
cat ~/.gitconfig
,存在如下內(nèi)容即代表成功:
[credential] helper = store 12
注:使用HTTP/HTTPS協(xié)議clone代碼時(shí),不需要配置SSH key。
注:所謂的使用HTTP/HTTPS協(xié)議,打開.git/config
文件,url協(xié)議是http/(s):文章來源:http://www.zghlxwxcb.cn/news/detail-644984.html
[remote "origin"]
url = http://git.aaa.com/aaa/aaa.git
fetch = +refs/heads/*:refs/remotes/origin/*
參考:
https://blog.csdn.net/lonelymanontheway/article/details/118107326
https://blog.csdn.net/tsq292978891/article/details/89316612文章來源地址http://www.zghlxwxcb.cn/news/detail-644984.html
到了這里,關(guān)于linux配置git賬號密碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!