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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16433970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:06:29  来源:igfitidea点击:

Unable to auto-detect email address

gitgit-configsmartgit

提问by Arreane Diez Coyoca

I'm new to SmartGit. I can't commit through my repository, the message I'm receiving is:

我是 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

I'm using a different PC, but if I commit at home it commits and pushes perfectly, I don't know if this was the cause of the problem.

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

I've searched around and others say to edit the .git/configfile, but I cannot find this file.

我四处搜索,其他人说要编辑该.git/config文件,但我找不到该文件。

What am I missing?

我错过了什么?

回答by michas

Well, the message is pretty much self-explanatory. You did not tell git what your name and email address is.

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

Open a command line and type:

打开命令行并输入:

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

Of course you should enter your real name and email. Afterwards git knows who you are and is able to insert this information in your commits.

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

Seems like smartgit does not add the git binary to your path. You have to add its path to the PATH environment variable or first change to the corresponding directory. You can find a screencast here: http://blog.dragndream.com/?p=97

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

回答by DoronK

If you are using sourcetree: Repository -> Repository Settings --> Advanced --> uncheck "Use global user settings" box

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

worked great for me.

对我很有用。

回答by Shayan Amani

You can solve the problem with the global solution, but firstly I want to describe the solution for each project individually, cause of trustfully compatibility with most of Git clients and other implemented Git environments:

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

  • Individual Solution
  • 个人解决方案

Go to the following location:

前往以下位置:

Local/repo/location/.git/

open "config" file there, and set your parameters like the example (add to the end of the file):

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

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

Open a command line and type:

打开命令行并输入:

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

回答by Jun Young Ahn

Just type like "correct" case

只需键入“正确”大小写

"wrong"

“错误的”

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

"correct"

“正确的”

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

user.name is your account name in git-hub user.email is your email when you sign in git-hub.

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

回答by Suraj Verma

Try the following steps,

尝试以下步骤,

  1. Open command prompt and then run
  2. git config --global user.email "[email protected]"// put your email address press enter
  3. git config --global user.name "YOUR NAME"// put your name
  1. 打开命令提示符,然后运行
  2. git config --global user.email "[email protected]"//输入你的电子邮件地址按回车
  3. git config --global user.name "YOUR NAME"// 输入你的名字

回答by Aashutosh Taikar

it's pretty simple but tricky at the first time.
For example:
If my email is [email protected]type:

第一次很简单但很棘手。
例如:
如果我的电子邮件[email protected]类型为:

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

OR

或者

If my username is mrsuicidesheeptype:

如果我的用户名是mrsuicidesheep类型:

git config user.name mrsuicidesheep

回答by Santosh

This problem has very simple solution. Just open your SmartGit, then go to Repository option(On top left), then go to settings. It will open a dialog box of Repository Settings. Now, click on Commit TAB and write your UserName and EmailId which you give on BitBucke website. Now click ok and again try to Commit and it works fine now.

这个问题有非常简单的解决方案。只需打开您的 SmartGit,然后转到存储库选项(在左上角),然后转到设置。它将打开一个存储库设置对话框。现在,单击 Commit TAB 并写下您在 BitBucke 网站上提供的 UserName 和 EmailId。现在单击确定并再次尝试提交,它现在工作正常。

回答by Bryan Jiencke

With SmartGit, you can also edit them by going to Project > Repository settings and hitting the "Commit" tab (make sure to have "Remember as default" selected).

使用 SmartGit,您还可以通过转到 Project > Repository settings 并点击“Commit”选项卡(确保选择“Remember as default”)来编辑它们。

回答by alan

In case you're using git, use the right email address you used for github registration and then your computer name. this worked for me.

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

回答by user13632722

Put your computer's username

输入你电脑的用户名

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