我最近将一个Git仓库转移到了新的组织中。我运行了以下命令:
git remote set-url origin https://github.com/organizationname/therepo.git
我已经成功地从新的位置拉取/推送了代码。但是每次我运行Git命令时都会出现以下错误:
error: key does not contain a section: repositoryformatversion
error: key does not contain a section: filemode
error: key does not contain a section: bare
error: key does not contain a section: logallrefupdates
error: key does not contain a section: ignorecase
error: key does not contain a section: precomposeunicode
我最初认为这与我的配置文件有关,但那些字段都存在。 我的 /.git/config
文件的前几行看起来像这样:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
在这个答案中建议检查
--get-regex
,但是我在我的配置文件或.gitconfig
文件中没有看到任何与之相关的引用。看起来我有2个git配置文件:/usr/local/git/etc/gitconfig
和/Users/chmd/.gitconfig
。我尝试将这些键添加到/Users/chmd/.gitconfig
文件中,但没有成功。我错过了哪一步来清除这些错误?基于之前的答案和研究,它似乎是我的配置问题,但是我已经在我的gitconfig中加入了这些字段?
.git/config
文件吗?如果正确使用Git的话,这个文件以这种方式结束是极其不可思议的。或者,也许你正在使用一个不使用git config
来处理配置文件的GUI客户端,它破坏了你的文件。 - axiac