2017-02-20 34 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