git免密码

1. .git-credentials文件方式

cd ~
echo https://{username}:{password}@github.com > ./.git-credentials
git config --global credential.helper store

2. 添加环境变量方式(windows)

在windows中添加一个HOME环境变量,变量名:HOME,变量值: %USERPROFILE%
进入%HOME%目录,新建一个名为”_netrc”的文件,文件中内容格式如下:

machine {git account name}.github.com
login your-username
password your-password