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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章