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
"*** Please tell me who you are." when using SSH key
提问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 & email
to do a commit.
注意:您已成功通过身份验证,但 git 需要您username & email
进行提交。
It is not related to authentication. Your username/email
can 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.email
will be set globally in ~/.gitconfig
file.
这个user.name
&user.email
将在~/.gitconfig
文件中全局设置。
$ cat ~/.gitconfig # see global config file