从git删除密码 [英] Remove password from git

查看:92
本文介绍了从git删除密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我更改文件并写:

git add .
git commit -m "test"
git push

然后git自动将其推送到我的github帐户,而无需询问用户名和密码.我已经尝试过:

then git automaticaly pushes it to my github account without asking about username and password. I have tried:

git config --global --remove-section user
git config --global --unset-all user.name
git config --global --unset-all user.email
git config --global --unset-all user.password

但没有帮助...
我也删除了带有git SSH密钥的文件夹.
当我提交时,我收到一条消息:Committer: Xxx Xxx <xxx@xxx.com> Your name and email address were configured automatically based on your username and hostname.但是此电子邮件xxx@xxx.com与我的github帐户电子邮件不同... 为什么git仍然可以识别密码和用户名?

but didn't help...
I have also delete folder with git SSH keys.
When I commit I get a message: Committer: Xxx Xxx <xxx@xxx.com> Your name and email address were configured automatically based on your username and hostname. But this email xxx@xxx.com differs from my github account email... Why still git recognizes password and username?

推荐答案

发生了两件事之一:

  • 您的Git存储库未受保护,您允许匿名推送到它.
  • 您的Git存储库配置有本地计算机上的SSH密钥.

如果您想要求 Git要求您提供用户名和密码,则无需使用git://协议;只需使用https://协议即可解决该问题.

If you want to require that Git ask you for a username and password, then you need to not use the git:// protocol; simply using the https:// protocol will address the issue.

为此,将存储库的远程分支更改为https .

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

这篇关于从git删除密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆