git出現error: key does not contain a section: trustexitcode 錯誤,經分析應該是~/.gitconfig中信息配置有錯誤。
終端命令打開~/.gitconfig
vim ~/.gitconfig
發現存在兩行 trustExitCode = true ,
一行在 [mergetool "sourcetree"] 上面,一行在下面,報錯說error: key does not contain a section: trustexitcode 那么錯誤應該就在trustExitCode = true 這里了。
解決方案:
刪除[mergetool "sourcetree"] 上面的那行trustExitCode = true ,
保留cmd下面的那行trustExitCode = true 。
然后按 Esc ,輸入 :wq 保存並退出,
重新終端運行git命令,問題解決,不再報錯。