[linux服務(wù)器git pull/push時(shí)提示輸入賬號(hào)密碼之免除設(shè)置

linux服務(wù)器git pull/push時(shí)提示輸入賬號(hào)密碼之免除設(shè)置

1、先cd到根目錄,執(zhí)行g(shù)it config --global credential.helper store命令

<pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">[root@iZ25mi9h7ayZ ~]# git config --global credential.helper store</pre>

2、執(zhí)行之后會(huì)在.gitconfig文件中多加紅色字體項(xiàng)

<pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">[user]
name = 天明
email = xxxx@xxxx.com
[credential]
helper = store</pre>

3、之后cd到項(xiàng)目目錄,執(zhí)行g(shù)it pull命令,會(huì)提示輸入賬號(hào)密碼。輸完這一次以后就不再需要,并且會(huì)在根目錄生成一個(gè).git-credentials文件

<pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">[root@iZ25mi9h7ayZ test]# git pull
Username for 'https://git.oschina.net': xxxx@xxxx.com
Password for 'https://xxxx@xxxx.com@git.oschina.net':</pre>

<pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">[root@iZ25mi9h7ayZ ~]# cat .git-credentials
https://Username:Password@git.oschina.net</pre>

4、之后pull/push代碼都不再需要輸入賬號(hào)密碼了~

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容