linux服务器git pull/push时提示输入账号密码之免除设置

在使用Git命令的时候,经常会遇到输入账号密码的情况,在提交特别频繁的项目中,使用起来很是不方便。此文主要介绍了如何添加git配置,使得记住输入的帐号密码。一次输入之后,以后就不用再次输入了(git下载地址)

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

# 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代码都不再需要输入账号密码了~

评论

1条评论
  1. 哈哈 回复

    😛 哈哈,支持一下啊

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注