【问题标题】:Git bash setup rejecting global/ local parameters, can't set up user accountGit bash设置拒绝全局/本地参数,无法设置用户帐户
【发布时间】:2016-07-06 18:04:05
【问题描述】:

操作系统:Win8.1 64bit; Git v 2.9.0

Git bash 2.9.0 设置拒绝用户名和电子邮件配置错误消息。

  • 已安装 -> exe'd -> 没有欢迎消息,只有计算机名称和 $prompt。
  • 在命令中,我输入了我们的 TA 提供的代码:config [--local | --global] user.email "my email@etc.com";接收错误消息:: --global] user.email command not found
  • 对 user.name "name" 重复并记录了这些错误:: bash: -global] user.email command not found;错误:键不包含 [--local.这些是 TA 在小组讨论时留下的指示。
  • 然后我尝试将 global 单独括起来(git config [--global] 并记录了一个致命错误:不在 git 目录中。
  • 我卸载了程序并想重新安装,但担心新的 d/load 会从程序的第一个实例中获取旧设置。 我需要做什么来设置我的 git bash?我有一个任务几天后到期。谢谢你。

【问题讨论】:

    标签: git bash


    【解决方案1】:

    在命令中,我输入了我们的 TA 提供的代码:config [--local | --global] user.email "我的邮箱@etc.com";接收错误消息:: --global] user.email command not found

    符号[--local | --global] 是可选的OR 选项。 [-A|-B] 表示您应该使用-A-B 作为参数来调用程序。所以,你想:

    $ git config --local user.email you@example.com

    $ git config --global user.email you@example.com

    来自git help config:(粗体是我的)

    读取时,默认从系统、全局和repository本地配置文件中读取值,可以使用--system、--global、--local和--file选项 告诉命令仅从该位置读取(参见“文件”部分)。

    • --local 表示仅存储库配置。
    • --global 表示你所有的 git 操作(用户级别)
    • --system 表示系统范围的配置(用户默认为那些没有设置以上级别的配置)

    【讨论】:

    • 对不起,JrBenito,直到我发帖后才看到你的答案。你的回答好多了,谢谢。
    • @KEll 不用抱歉,毕竟您找到了解决方案,这是主要目标;我们在分享知识对吗?此外,您仍然可以接受一个或另一个作为原始问题的答案。
    【解决方案2】:
    • 本地或全局参数周围没有括号。
    • 定义的参数和实参之间有空格
    • user.name 输入为:

      $ git config --global user.name "Your Name"
      $ git config --local user.name "Your Name"
      
    • user.email 输入为:

      $ git config --global user.email "Your email"
      $ git config --local user.email "Your email
      

    验证用户名和用户电子邮件:

    $ git config --list
    

    【讨论】:

      猜你喜欢
      • 2017-06-10
      • 1970-01-01
      • 1970-01-01
      • 2020-10-19
      • 1970-01-01
      • 2014-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多