linux服务器git pull/push时提示输入账号密码之免除设置
1、先cd到根目录,执行git config --global credential.helper store命令
[root]# git config --global credential.helper store
2、执行之后会在.gitconfig文件中多加红色字体项
[user]
name = 名称
email =[email protected]
[credential]
helper = store
3、之后cd到项目目录,执行git pull命令,会提示输入账号密码。输完这一次以后就不再需要,并且会在根目录生成一个.git-credentials文件
[[email protected]]# git pull
Username for 'https://xxx': [email protected]
Password for 'https://[email protected]@git.xxx.net':
[[email protected]]# cat .git-credentials
https://Username:[email protected]
4、之后pull/push代码都不再需要输入账号密码了~
不想保存账号密码了,删掉也可以
已保存过密码,发现不好修改:可以这样设置
git remote set-url origin https://zengyihong:[email protected]/www.xxx/com.git