首页 > 解决方案 > 使用 SSH 的 Git 提交请求电子邮件

问题描述

我正在尝试提交到我的 github 存储库,但我不断收到一条错误消息,要求我通过电子邮件和姓名登录来证明自己的身份。我使用 ssh 进行提交,我的 sshconfig 和密钥配置正确。我还检查了 gitconfig 文件,它们似乎也是正确的。有什么想法吗?

###Gitconfig file
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = git@github.com:imran1005/testhomere.git
    fetch = +refs/heads/*:ref
[branch "master"]
    remote = origin
    merge = refs/heads/master

###Error msg on console win7 cmd while executing git commit:

*** 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 'TestUser@Asus.(none)')

标签: gitgithubsshcmdgitlab

解决方案


正如错误消息所述,您需要设置user.emailuser.namegit 配置。此信息存储在提交中,没有它们 git 将无法工作。

我的 sshconfig 和密钥配置正确

这无关紧要,当您将现有提交推送到某个远程时使用 ssh 密钥,而不是在创建新提交时使用。


推荐阅读