git for windows 总是提示输入用户名和秘密

时间:2025-05-16 08:24:11

建议提前升级git到最新版本

删除.gitconfig,重新执行以下操作


创建文件存储GIT用户名和密码
打开git bash客户端,进入%HOME%目录(一般为C:\users\yourUserName\),执行以下命令,注意要带上大括号
>>touch .git-credentials
>>vim .git-credentials
https://{username}:{password}@

添加Git Config 内容
进入git bash终端, 输入如下命令:
git config --global store

执行完后查看%HOME%目录下的.gitconfig文件,会多了一项
[credential]
    helper = store


重新开启git bash会发现git push时不用再输入用户名和密码


原文 /ballwql/p/