“git init” failed, what's wrong?

前端 未结 6 2014
花落未央
花落未央 2021-02-07 10:26

This issue is not same as \"Bad git config file .git/config\", since it failed when using git init.

It seems there is nothing wrong with /home/mirror/.gitco

6条回答
  •  半阙折子戏
    2021-02-07 11:11

    Note that it can be problematic identifying the issue, considering the problem is at:

    • line 7 (default = simple),
    • not line 8 (which here doesn't exist)

    Solutions:

    • Changing the value at line 7 solves the issue (git config --global push.default matching)
    • removing the config can help too (git config --global --unset-all push.default)

    But most importantly, starting git 2.2 (Q4 2014), the git config error line number will be accurate.
    See commit b3b3f60, by Matthieu Moy (moy):

    config.c: fix accuracy of line number in errors

    If a callback returns a negative value to git_config*() family, they call die() while printing the line number and the file name.
    Currently the printed line number is off by one, thus printing the wrong line number.

    Make linenr point to the line we just parsed during the call to callback to get accurate line number in error messages.

提交回复
热议问题