git - git 如何解析 user.email 和密码来验证用户身份?

标签 git

我有全局 git 配置 (~/.gitconfig),我的电子邮件是 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eb9884868ebe988e99ab9884868e8e868a8287c5888486" rel="noreferrer noopener nofollow">[email protected]</a>

当我在本地存储库中时(我之前使用 https 进行了身份验证)并且输入 git config user.email我的用户名仍然是 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b5844464e7e584e596b5844464e4e464a424705484446" rel="noreferrer noopener nofollow">[email protected]</a>

但是,对于这个本地存储库,我使用的电子邮件地址与我拥有的电子邮件地址和配置中显示的电子邮件地址不同。

问题是,git 如何知道要使用哪个电子邮件/用户?我还检查了本地存储库 .git/config 中的文件 -> 根本没有有关电子邮件的信息。

最佳答案

git config --list --show-origin

此命令将向您显示所有配置选项以及设置该选项的每个文件的位置。

来自docs :

When reading, the values are read from the system, global and repository local configuration files by default, and options --system, --global, --local, --worktree and --file can be used to tell the command to read from only that location (see FILES).

...

ENVIRONMENT

GIT_CONFIG

Take the configuration from the given file instead of .git/config. Using the "--global" option forces this to ~/.gitconfig. Using the "--system" option forces this to $(prefix)/etc/gitconfig.

关于git - git 如何解析 user.email 和密码来验证用户身份?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57713114/

相关文章:

javascript - 尝试在需要管道的子进程中运行 git 命令

GitHub:设置 SSH

Git .gitignore 只忽略根目录中的文件夹

git - 如何管理 GitHub 上具有未存储在 GitHub 上的外部 git 依赖项的项目

ruby - 基本 ruby​​ 脚本未按预期工作

windows - Github 和 Putty SSH key 放置配置有什么区别?

git - 在克隆之前更改 SSH 远程上的 Git 分支

java - 使用 JGit 授权错误推送到 GitLab

git - 是否可以在 git repo 上切换用户?

git - 我无法将目录添加到 .gitignore