这是我在 GitHub 上第一次设置存储库。我正在运行 Linux,并且我的 GitHub 帐户已为我的计算机设置了 ssh-keys。
当我尝试运行时git commit,出现此错误。
git commit -m "examples"
*** 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 'j0h@sx.(none)')
j0h@sx:~/Learning-OpenCV-3_examples$ git config --global user.email "you@example.com"
Run Code Online (Sandbox Code Playgroud)
我不明白的是,当它说这是否意味着我电脑上的名称时,它要求哪个名称和身份git config --global user.name "Your Name"?或者我的 GitHub 用户名?或者我的电子邮件用户名?或者是其他东西?
我尝试了多种组合,但仍然无法通过命令行提交。
这里有两个问题:
\n\n首先,您的身份应该只是您的全名和电子邮件地址,这可以是您的 GitHub 用户名和电子邮件组合。但这并不是一个验证阶段,而是一个 \xe2\x80\x9ctag\xe2\x80\x9d 来识别你的身份;这与您的 GitHub 用户名没有直接关系,除非它们确实是同一个。
\n\n因此,这些命令的您的版本可能是:
\n\ngit config --global user.email "j0h@example.com"\ngit config --global user.name "jOh"\nRun Code Online (Sandbox Code Playgroud)\n\n然后像这样检查这些值:
\n\ngit config -l\nRun Code Online (Sandbox Code Playgroud)\n\n输出应该是这样的;我自己对该命令的输出的修改版本,因此credential.helper和core.editor设置对您来说可能会有所不同:
credential.helper=osxkeychain\nuser.name=jOh\nuser.email=j0h@example.com\ncore.editor=nano\nRun Code Online (Sandbox Code Playgroud)\n\n但你接着说:
\n\n\n\n\n当我尝试运行 git commit 时,出现此错误。
\n\nRun Code Online (Sandbox Code Playgroud)\ngit commit -m "examples"\n
好吧,该命令缺少-awhich 的别名,--all根据 的页面,其含义man如下git-commit:
\n\n\n告诉命令自动暂存已修改和删除的文件,但您未告知 Git 的新文件不受影响。
\n
所以命令是:
\n\ngit commit -a -m "examples"\nRun Code Online (Sandbox Code Playgroud)\n\n如果您尚未将文件添加到存储库,则可以运行git add特定文件:
git add [filename]\nRun Code Online (Sandbox Code Playgroud)\n\n或者也许只是使用通配符来获取所有文件集:
\n\ngit add *\nRun Code Online (Sandbox Code Playgroud)\n\n然后运行git commit这样的命令:
git commit -a -m "examples"\nRun Code Online (Sandbox Code Playgroud)\n