1. 程式人生 > >linux服務器git pull/push時提示輸入賬號密碼之免除設置

linux服務器git pull/push時提示輸入賬號密碼之免除設置

color als name 服務 tco pan span per 文件中

1、先cd到根目錄,執行git config --global credential.helper store命令

[root@iZ25mi9h7ayZ ~]# git config --global credential.helper store

2、執行之後會在.gitconfig文件中多加紅色字體項

[user]
        name = 天明
        email = [email protected]
[credential]
        helper = store

3、之後cd到項目目錄,執行git pull命令,會提示輸入賬號密碼。輸完這一次以後就不再需要,並且會在根目錄生成一個.git-credentials文件

[root@iZ25mi9h7ayZ test]# git pull
Username for ‘https://git.oschina.net‘: [email protected]
Password for ‘https://[email protected]@git.oschina.net‘:
[root@iZ25mi9h7ayZ ~]# cat .git-credentials
https://Username:[email protected]

4、之後pull/push代碼都不再需要輸入賬號密碼了~

linux服務器git pull/push時提示輸入賬號密碼之免除設置