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

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代碼都不再需要輸入賬號密碼了~

 

如果這個時候,還是提示需要輸入賬號,那就要進項目的根目錄,.git 目錄的 config裏 找到 

[remote "origin"]
url = http://test.prect.com.git

修改這裏的url 
 
同樣,在mac 下也可能有同樣的問題
https://www.cnblogs.com/uglyliu/p/8482638.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章