【发布时间】:2016-06-28 08:05:08
【问题描述】:
不确定这是否是发布此问题的正确位置,但是:
当我尝试在我的 Git bash 窗口中执行任何操作时,我收到此错误:
fatal: unknown error occured while reading the configuration files
我在不同的配置下尝试了几次重新安装,并尝试了多次重新启动,但没有任何帮助。我在 Windows 上质疑我的用户名,因为它有一个点 (.)。这会因为某种原因让 Git 感到困惑吗?如果是这样:是否有解决方法?
我似乎也无法找到我的配置文件所在的位置,因为查找它的命令被破坏并显示相同的错误消息。
我在我的电脑上搜索了.gitconfig 文件。我一共找到了4个文件:
C:\Program Files\Git\mingw64\etc\.gitconfigC:\Program Files\Git\usr\share\vim\vim74\ftplugin\.gitconfigC:\Program Files\Git\usr\share\vim\vim74\indent\.gitconfigC:\Program Files\Git\usr\share\vim\vim74\syntax\.gitconfig
这是每个文件的内容
...\Git\mingw64\etc.gitconfig
[credential]
helper = manager
...\Git\usr\share\vim\vim74\ftplugin.gitconfig
" Vim filetype plugin
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2009 Dec 24
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:#,:; commentstring=;\ %s
let b:undo_ftplugin = "setl fo< com< cms<"
...\Git\usr\share\vim\vim74\indent.gitconfig
" Vim indent file
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2013 May 30
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetGitconfigIndent()
setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
let b:undo_indent = 'setl ai< inde< indk<'
" Only define the function once.
if exists("*GetGitconfigIndent")
finish
endif
function! GetGitconfigIndent()
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
return 2 * &sw
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
return &sw
elseif cline == '' && line =~ '^\['
return &sw
else
return -1
endif
endfunction
Git\usr\share\vim\vim74\syntax.gitconfig
" Vim syntax file
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: gitconfig, .gitconfig, *.git/config
" Last Change: 2010 May 21
if exists("b:current_syntax")
finish
endif
setlocal iskeyword+=-
setlocal iskeyword-=_
syn case ignore
syn sync minlines=10
syn match gitconfigComment "[#;].*"
syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
syn keyword gitconfigBoolean true false yes no contained
syn match gitconfigNumber "\d\+" contained
syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
syn match gitconfigError +\\.+ contained
syn match gitconfigEscape +\\[\\"ntb]+ contained
syn match gitconfigEscape +\\$+ contained
hi def link gitconfigComment Comment
hi def link gitconfigSection Keyword
hi def link gitconfigVariable Identifier
hi def link gitconfigBoolean Boolean
hi def link gitconfigNumber Number
hi def link gitconfigString String
hi def link gitconfigDelim Delimiter
hi def link gitconfigEscape Delimiter
hi def link gitconfigError Error
let b:current_syntax = "gitconfig"
我运行的是 Windows 7 x64 Professional。该计算机是域网络的一部分。
我在谷歌上搜索了这个问题,当我来到第 11 页却没有任何用处时放弃了。
【问题讨论】:
-
你有一些已知的好 .gitconfig 文件吗?如果是这样,请尝试在他们之间进行
diff看看是否有不同之处。 -
所有 vim 配置文件都不感兴趣。至于用于 Winfdows 的 Git,在您的用户配置文件目录中还有“C:\ProgramData\Git\config”和
.gitconfig或.config\git\config。其中一个文件不可读 - 通常不需要以管理员身份运行 git。 -
我建议运行 procmon 并注意读取或权限被拒绝错误。
标签: git