【问题标题】:Why Git is not allowing me to commit even after configuration?为什么即使在配置之后 Git 也不允许我提交?
【发布时间】:2013-01-17 17:21:30
【问题描述】:

这个问题似乎是重复的,但实际上并非如此。只是一个不断重复的细微差别。 git 不断告诉我:“请告诉我你是谁”,即使在设置之后也是如此。当我运行git commit 时,这就是我得到的......

$ git commit

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'Obby@ObbyWorkstation.(none)')

但是当我运行git config --global -l 时,它会提供我所有的详细信息...

$ git config --global -l
user.name=myname
user.mail=me.myself@gmail.com
http.proxy=proxy.XX.XX.XX:XXXX

我已经更改了我的姓名、电子邮件和代理,但是当我运行命令时它们看起来很好,即使在 .gitconfig 文件中我也可以看到这些值已设置。可能缺少什么,因为我根本无法承诺。每次它总是问我是谁?

@sheu 告诉我一些我改变的东西,但仍然是同样的问题。当我设置--local 时,git commit 仍然问我同样的问题。这是输出

$ git config --local -l
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
user.name=myname
user.mail=me.myself@gmail.com

【问题讨论】:

  • 也许这篇文章可以回答你的问题stackoverflow.com/questions/2936652/…
  • @SumitMunot,我找不到有用的东西...我只有 master 分支,没有其他分支
  • @SumitMunot 在建议编辑时,请不要添加诸如“请帮助”和“提前致谢”之类的内容。不鼓励使用这样的短语,因为它们会给问题添加不必要的噪音。此外,您正在积极更改问题的标题,但在许多情况下缺少动词“是”。请确保您在建议编辑时使用正确的语法。
  • 全局配置中不应该是user.email吗(注意email中的e)?

标签: git github commit config


【解决方案1】:

这是一个错字。您不小心在 e 邮件中设置了 user.mail 而没有 e。通过在全局配置中设置user.email 来修复它

git config --global user.email "you@example.com"

【讨论】:

  • 谢谢...我什至无法发现。按向上箭头而不是重新写入的问题
  • 天啊!犯了同样的错误。
  • 抱歉,我不明白我需要在哪里设置或编辑?
  • 5 年后我犯了同样的错误!
  • 令人难以置信的是,一个错字会浪费这么多时间!谢谢老兄!
【解决方案2】:

即使在正确设置配置后我也遇到了这个问题。 git config

我的场景是通过主管(在 Linux 中)发出 git 命令。在进一步调试时,主管没有从主文件夹中读取 git 配置。因此,我必须在主管配置中设置环境 HOME 变量,以便它可以正确定位 git 配置。奇怪的是,主管无法仅从主管配置中配置的用户名(/etc/supervisor/conf.d)中找到 git 配置。

【讨论】:

    【解决方案3】:

    您是否有覆盖全局的user.nameuser.email

    git config --list --global | grep user
      user.name=YOUR NAME
      user.email=YOUR@EMAIL
    git config --list --local | grep user
      user.name=YOUR NAME
      user.email=
    

    如果是这样,删除它们

    git config --unset --local user.name
    git config --unset --local user.email
    

    本地设置是针对每个克隆的,因此您必须为计算机上的每个存储库取消设置本地 user.nameuser.email

    【讨论】:

      【解决方案4】:

      您正在设置全局 git 选项,但本地结帐可能设置了覆盖。尝试使用git config --local <setting> <value> 再次设置它们。您可以查看本地结帐中的.git/config 文件,以查看结帐定义了哪些本地设置。

      【讨论】:

      • 您可以在控制面板中擦除您的 git 数据:控制面板 → 用户帐户 → 凭据管理器→ Windows 凭据管理器。然后使用正确的用户名和密码重新输入。这是唯一对我有用的选项。
      猜你喜欢
      • 2010-12-25
      • 2021-08-21
      • 1970-01-01
      • 2020-10-21
      • 2011-07-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      相关资源
      最近更新 更多