git 免密码提交代码

Linux或者Mac下方法:

创建文件,进入文件,输入内容:

cd ~
touch .git-credentials
vim .git-credentials
https://{username}:{password}@github.com
在终端下输入:

git config --global credential.helper store
打开~/.gitconfig文件,会发现多了一项:

[credential]
helper = store
Windows方法: 方法同上面,只是第一步创建git
-credentials有点不同。在%HOME%目录中,一般为C:usersAdministrator,也可以是你自己创建的系统用户名目录,反正都在C:users中。文件名为.git-credentials,由于在Window中不允许直接创建以"."开头的文件,所以需要借助git bash进行,打开git bash客户端,进行%HOME%目录,然后用touch创建文件 .git-credentials, 然后后面的操作同上面。
原文地址:https://www.cnblogs.com/xczssl/p/6290429.html