1、先cd到根目錄,執行git config --global credential.helper store命令
[root@iZ25mi9h7ayZ ~]# git config --global credential.helper store
2、執行之后會在.gitconfig文件中多加紅色字體項
[user] name = 天明 email = xxxx@xxxx.com [credential] helper = store
3、之后cd到項目目錄,執行git pull命令,會提示輸入賬號密碼。輸完這一次以后就不再需要,並且會在根目錄生成一個.git-credentials文件
[root@iZ25mi9h7ayZ test]# git pull Username for 'https://git.oschina.net': xxxx@xxxx.com Password for 'https://xxxx@xxxx.com@git.oschina.net':
[root@iZ25mi9h7ayZ ~]# cat .git-credentials https://Username:Password@git.oschina.net
4、之后pull/push代碼都不再需要輸入賬號密碼了~
