Git pull避免用户名和密码方法

 linux下

1. 在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入:

    https://{username}:{password}@github.com

 注意去掉{}


2. 在终端下执行  git config --global credential.helper store

3. 可以看到~/.gitconfig文件,会多了一项:
    [credential]
        helper = store

windows下
1. 添加一个HOME环境变量,变量名:HOME,变量值:%USERPROFILE%

2. 创建git用户名和密码存储文件
git bash进入%HOME%目录,新建一个名为"_netrc"的文件,内容如下:
    machine {git account name}.github.com
    login your-usernmae
    password your-password

猜你喜欢

转载自blog.csdn.net/ch5057997/article/details/78517311