【问题标题】:Can't commit a new file无法提交新文件
【发布时间】:2019-04-24 07:43:55
【问题描述】:

我在 Chromebook 上使用 Linux 操作系统。我正在学习Java。我从 GitHub 下载了一个存储库。它缺少 .gitignore 文件,所以我创建了它并尝试提交它,但我收到一条消息

$ git commit -m "I've created .gitignore file"

*** 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: empty ident name (for <(null)>) not allowed

我已经完成了,我输入了我的 GitHub 电子邮件,然后输入了我的名字和姓氏。

$ git config --global "my_GitHub_account_email@gmail.com" 
$ git config --global "Name Surname"

但是当我输入我的名字时,我会收到一条消息:

error: key does not contain a section: Name Surname

我做错了什么?

【问题讨论】:

  • 你能用你输入的实际命令更新你的问题吗?
  • 你能看一下你的 .gitconfig 看看它的格式是否正确吗?
  • $ cat .gitignore /bin/ .idea/* .classpath* .project* *.iml
  • 我从来没有使用过Linux系统,我所做的一切都是我在google上搜索的。我按照课程视频中的所有步骤进行操作。我还尝试创建一个文本文件 abc.txt。它仍然带来同样的错误。

标签: git


【解决方案1】:

你输入了

$ git config --global "my_GitHub_account_email@gmail.com" 
$ git config --global "Name Surname"

你忘记了 user.nameuser.email

您必须输入的命令是:

$ git config --global user.email "my_GitHub_account_email@gmail.com" 
$ git config --global user.name "Name Surname"

【讨论】:

    【解决方案2】:

    你正在运行没有双顶点的git config --global user.name "Your Name",像这样:

    git config --global user.name my name and username
    

    这样跑

    git config --global user.name "my name and username"
    

    【讨论】:

      猜你喜欢
      • 2019-09-10
      • 1970-01-01
      • 2012-10-19
      • 2014-01-21
      • 2023-01-18
      • 1970-01-01
      • 2011-07-27
      • 2011-03-19
      • 1970-01-01
      相关资源
      最近更新 更多