创建存储用户名密码的文件
在home文件夹,一般是 C:\Documents and Settings\Administrator 下建立文件 .git-credentials (windows下不允许直接创建以.开头的文件,所以有一个小技巧:先创建一个文件名叫 )git-credentials 然后进入 git bash 使用命令:
mv git-credentials .git-credentials
用记事本打开这文件输入:
https://{username}:{password}@github.com
比如:
https://zhangsan:123456@github.com
保存
添加config项
在任意文件夹下右键进入 git bash
然后输入:
git config --global credential.helper store
执行完后去查看 C:\Documents and Settings\Administrator\.gitconfig 这个文件,发现多了一项:
[credential]
helper = store
就成功了。
然后要重开 git bash 窗口,再提交就不用输入用户名密码
在home文件夹,一般是 C:\Documents and Settings\Administrator 下建立文件 .git-credentials (windows下不允许直接创建以.开头的文件,所以有一个小技巧:先创建一个文件名叫 )git-credentials 然后进入 git bash 使用命令:
mv git-credentials .git-credentials
用记事本打开这文件输入:
https://{username}:{password}@github.com
比如:
https://zhangsan:123456@github.com
保存
添加config项
在任意文件夹下右键进入 git bash
然后输入:
git config --global credential.helper store
执行完后去查看 C:\Documents and Settings\Administrator\.gitconfig 这个文件,发现多了一项:
[credential]
helper = store
就成功了。
然后要重开 git bash 窗口,再提交就不用输入用户名密码
本文介绍如何在Windows系统中设置.git-credentials文件以实现GitHub用户名密码自动填充,并通过git config命令启用这一功能。
如何记住用户名和密码&spm=1001.2101.3001.5002&articleId=84740706&d=1&t=3&u=e98f1c068cf74b5e88ee0692b4b73cb3)
1万+

被折叠的 条评论
为什么被折叠?



