无法自动检测电子邮件地址

问题描述 投票:0回答:17

我是 SmartGit 新手。我无法通过我的存储库提交,我收到的消息是:

Unable to auto-detect email address (got 'Arreane@Arreane-PC.(none)')

*** Please tell me who you are.

Run
  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"


to set your account's default identity.

Omit --global to set the identity only in this repository

我使用的是另一台电脑,但如果我在家提交,它会完美地提交和推送,我不知道这是否是问题的原因。

我四处寻找,其他人说要编辑

.git/config
文件,但我找不到这个文件。

我错过了什么?

git git-config smartgit
17个回答
104
投票

嗯,这个消息几乎是不言自明的。你没有告诉 git 你的名字和电子邮件地址是什么。

打开命令行并输入:

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

当然您应该输入您的真实姓名和电子邮件。 之后 git 知道你是谁,并且能够在你的提交中插入这些信息。

似乎 smartgit 没有将 git 二进制文件添加到您的路径中。您必须将其路径添加到 PATH 环境变量中或首先更改为相应的目录。您可以在这里找到截屏视频:http://blog.dragndream.com/?p=97


23
投票

如果您使用的是sourcetree: 存储库 -> 存储库设置 -> 高级 -> 取消选中“使用全局用户设置”框

对我来说非常有用。


20
投票

您可以使用全局解决方案解决问题,但首先我想单独描述每个项目的解决方案,因为它与大多数Git客户端和其他已实现的Git环境完全兼容:

  • 个性化解决方案

前往以下位置:

Local/repo/location/.git/

在那里打开“config”文件,然后像示例一样设置参数(添加到文件末尾):

[user]
    name = YOUR-NAME
    email = YOUR-EMAIL-ADDRESS
  • 全球解决方案

打开命令行并输入:

git config --global user.email "[email protected]"
git config --global user.name "YOUR NAME"

11
投票

只需输入“正确”大小写即可

“错误”

git config --global mike.email "[email protected]"
git config --global mike.name  "mike"

“正确”

git config --global user.email "[email protected]"    
git config --global user.name "mike"

user.name 是你在 git-hub 中的帐户名 user.email 是您登录 git-hub 时的电子邮件。


6
投票

尝试以下步骤,

  1. 打开命令提示符,然后运行
  2. git config --global user.email "[email protected]"
    // 输入您的电子邮件 地址按回车键
  3. git config --global user.name "YOUR NAME"
    // 输入你的名字

2
投票

这个问题有非常简单的解决方案。只需打开您的 SmartGit,然后转到存储库选项(左上角),然后转到设置。它将打开一个存储库设置对话框。现在,单击“提交”选项卡并写入您在 BitBucke 网站上提供的用户名和电子邮件 ID。 现在单击“确定”并再次尝试“提交”,现在工作正常。


2
投票

这很简单,但第一次玩会很棘手。
例如:
如果我的电子邮件是

[email protected]
类型:

git config --global user.email [email protected]

如果我的用户名是

mrsuicidesheep
类型:

git config user.name mrsuicidesheep

1
投票

使用 SmartGit,您还可以通过转到“项目”>“存储库设置”并点击“提交”选项卡来编辑它们(确保选择“记住为默认值”)。


1
投票

输入您计算机的用户名

git config --global user.email "[email protected]"
git config --global user.name "YOUR COMPUTER\'S USERNAME"

1
投票

运行这些命令的示例:

git config --global user.email“[email protected]

git config --全局用户名“focus1”

脚注:

[email protected] === 用于登录 github 帐户的电子邮件地址。

focus === 你的github用户名


0
投票

如果您使用 git,请使用您用于 github 注册的正确电子邮件地址,然后使用您的计算机名称。这对我有用。


0
投票

打开 git 命令行

git config --global user.email“[email protected]

命令行上的此命令并更改电子邮件地址,输入您自己的电子邮件,这些电子邮件用于为 github 创建帐户

按回车键

放 git config --global user.name“你的名字”

用你自己的名字代替你的名字

按回车键

它的工作...


0
投票

在 SmartGit 中,打开首选项页面 Git Config,并在其中提供您的电子邮件和姓名。


-1
投票
git config --global user.email "put your email address here" # user.email will still be there  
git config --global user.name "put your github username here" # user.name will still be there

注意:它可能会提示您输入 git 用户名和密码。这对我来说效果很好。


-1
投票

请务必打开 cmd,而不是您正在处理的文件夹上的注释行!

对于 Windows,我通过从 Windows 开始菜单(Windows 按钮)打开 cmd 来修复它,而不是在我所在的文件夹上使用命令行 我试过了


-1
投票

我刚刚在另一台计算机上安装了 VSCode,并且出现了与您相同的错误。

您必须安装 GitHub 扩展并在 VSCode 上登录您的帐户。enter image description here


-4
投票

确保您以管理员或 root 身份打开 git。

© www.soinside.com 2019 - 2024. All rights reserved.