2017-02-20 35 views
2

我使用SSH密钥为git,我添加了ssh密钥并检查它是否成功验证。但我仍然无法提交代码“***请告诉我你是谁。”当使用SSH密钥

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

但我不能做承诺

$ 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 '[email protected](none)') 
+0

这是先前在覆盖[设置GIT中](https://help.github.com/articles/set-up-git/#setting-up-git) – Stefan

回答

7

运行
混帐配置--global user.email “[email protected]
混帐配置 - -global user.name“Your Name”

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

它与认证无关。您的username/email可能是与您的GitHub账户不同。

您需要针对单次运行运行以下命令。

$ 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 

user.name & user.email将在全球范围内~/.gitconfig文件中设置。

$ cat ~/.gitconfig  # see global config file 

See more details