【问题标题】:.git/config file reads "command not found".git/config 文件读取“找不到命令”
【发布时间】:2015-03-09 05:31:20
【问题描述】:

我正在尝试学习 git 并使用 mac osx 10.8

在查看我创建的存储库中的 .git/config 文件时,该文件读取,

/.git/config: line 1: [core]: command not found
/.git/config: line 2: repositoryformatversion: command not found
/.git/config: line 3: filemode: command not found
/.git/config: line 4: bare: command not found
/.git/config: line 5: logallrefupdates: command not found
/.git/config: line 6: ignorecase: command not found
/.git/config: line 7: precomposeunicode: command not found
/.git/config: line 8: [remote: command not found
/.git/config: line 9: url: command not found
/.git/config: line 10: fetch: command not found
logout

[Process completed]

什么时候,正如我的课本告诉我的,它应该说,

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/joesmith2444/my-first-repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

有谁知道可能是什么原因?如果需要任何其他细节,请告诉我。

【问题讨论】:

  • 您确定不是不小心将它作为 bash 脚本运行吗?只是验证这是文件的实际内容。
  • .git/config 是一个普通的 ini 样式文件,你不应该尝试执行它。 git config 是查询和/或更新此文件的命令

标签: macos git configuration-files


【解决方案1】:

您收到此错误是因为您尝试执行配置文件。选择以下选项之一:-

查看文件

cat .git/config

编辑文件

nano .git/config

【讨论】:

    【解决方案2】:

    您不应该尝试执行您的.git/config 文件...您可能想要执行git clone https://github.com/joesmith2444/my-first-repository.git

    还要确保您已安装 Git。也许您的 shell 有助于将“$PATH 中没有可执行的 git 二进制文件”进行拼写更正以“执行 $PATH 中看起来像 git 的第一件事”。

    【讨论】:

      猜你喜欢
      • 2022-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      相关资源
      最近更新 更多