Quirk with Invalid Git Config

I bumped into what seems like a weird quirk with one of my git config files today. A bad value was reported:

error: Malformed value for branch.autosetuprebase
fatal: bad config file line 18 in .git/config


In the image, you’ll notice the branch reads “(ref: re…)”

I was getting this error because I incorrectly had the value of “true” for branch.autosetuprebase instead of “always”. Luckily, the error line tells me which setting has the incorrect value, but reports it as line 18 when in actuality, the line is 17. If I misspell autosetuprebase, the following error is reported:

fatal: bad config file line 17 in .git/config

It seems weird that an error on the same line would report two different line numbers depending on whether it was the key or the value that contained the issue. If you run across a config error like this, just try to remember to look at the value if it supplies you with the setting. If it’s generic enough like the second error, it’s probably the right line number. Since I’m not a pro at git, I’d be curious to know why it behaves this way if anybody can provide any insight.

About Chris Missal

Oh hey, I'm a Senior Consultant for Headspring in Austin, TX. I've been working in software professionally since 2006 and I really, really love it. I'm mostly in the Microsoft world, but enjoy building computer things of all sorts (to be vague). When I'm not slinging code, I'm probably out and about slinging discs, bowling balls, or good beer with great friends.
This entry was posted in git. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • MMS

    Just a zero based index bug …