git “***请告诉我你是谁。” 使用 SSH 密钥时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42335599/
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-09 04:49:29  来源:igfitidea点击:

"*** Please tell me who you are." when using SSH key

gitgithub

提问by Charles PHAM

I'm using ssh key for git, after I added ssh key and check it authenticated successfully. But I still cannot commit code

在我添加了 ssh 密钥并检查它是否通过身份验证成功后,我正在将 ssh 密钥用于 git。但是我还是不能提交代码

$ eval "$(ssh-agent -s)"
Agent pid 2599

$ ssh-add ~/id_rsa
Identity added: /home/vagrant/id_rsa (/home/vagrant/id_rsa)

$ssh -T [email protected]
Hi my-git-username! You've successfully authenticated, but GitHub does not provide shell access. 

But I cannot do commit

但我不能提交

$ git commit -m "Develop Dockerfile for shopContainer"

*** 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.

fatal: unable to auto-detect email address (got 'vagrant@vagrant-ubuntu-trusty-64.(none)')

回答by Sajib Khan

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

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

Note:You are authenticated successfully but git needs your username & emailto do a commit.

注意:您已成功通过身份验证,但 git 需要您username & email进行提交。

It is not related to authentication. Your username/emailcan be different from your GitHub Account.

它与身份验证无关。您username/email可以与您的 GitHub 帐户不同。

You need to run the following commands for a single time.

您需要一次性运行以下命令。

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

$ git config --list    # see if the 'name' & 'email' are set correctly

This user.name& user.emailwill be set globally in ~/.gitconfigfile.

这个user.name&user.email将在~/.gitconfig文件中全局设置。

$ cat ~/.gitconfig     # see global config file

See more details

查看更多详情

回答by Grace Nikole

Type the same name that you have in your GitHub account.

键入与您在 GitHub 帐户中相同的名称。

GitHub account name:

GitHub 账户名:

GitHub account name

GitHub 账户名

git user.name:

git 用户名:

git user.name

git 用户名