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)密碼了~