您的位置:首页 > 其它

git pull 自动记录账号密码(转)

2017-09-07 00:00 169 查看
摘要: git pull 一遍一遍输密码让它自己记录一下
原帖地址http://www.cnblogs.com/orzlin/p/5613310.html

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

[root@localhost]# 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[/code] 4、之后pull/push代码都不再需要输入账号密码了~
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git 自动保存密码