"***请告诉我你是谁." 使用SSH密钥时

Cha*_*HAM 6 git github

在我添加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 git@github.com
Hi my-git-username! You've successfully authenticated, but GitHub does not provide shell access. 
Run Code Online (Sandbox Code Playgroud)

但我不能做出承诺

$ git commit -m "Develop Dockerfile for shopContainer"

*** Please tell me who you are.

Run

   git config --global user.email "you@example.com"
   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)')
Run Code Online (Sandbox Code Playgroud)

Saj*_*han 15

运行
git config --global user.email"you@example.com"
git config --global user.name"Your Name"

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

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

你需要运行以下命令为单时间.

$ git config --global user.email "you@example.com" 
$ git config --global user.name "Your Name"

$ git config --list    # see if the 'name' & 'email' are set correctly
Run Code Online (Sandbox Code Playgroud)

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

$ cat ~/.gitconfig     # see global config file
Run Code Online (Sandbox Code Playgroud)

查看更多详情