Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


interrupted git download leaves git in broken state #16520

mblakele opened this Issue · 5 comments

3 participants


If brew is interrupted while updating git, it leaves git unlinked - and in my environment unlinkable. Can anything be done to make this more robust? Maybe wait to unlink the old version until the new version is ready?

$ brew --version
$ brew update && brew outdated && brew upgrade
Updated Homebrew from 0a868aba to 9e4d2ca3.
==> Updated Formulae
git   go        nzbget    vcftools  wxmac
git (1.7.10,,,,,,,,,, 1.7.12,,,,, 1.8.0, <
==> Upgrading git
==> Downloading
###############################################################           88.3%

At this point the wifi goes down, and brew hangs. As it exits I see:

Warning: Could not link git. Unlinking...

Now any git-dependent brew functions are broken.

$ brew update && brew outdated && brew upgrade
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 18 in /Users/mblakele/.gitconfig
Error: Failure while executing: git checkout -q master 

All these errors appear to come from git not working. Maybe the doctor can help?

$ brew doctor
fatal: bad config file line 18 in /Users/mblakele/.gitconfig
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:


OK, but the suggested fix doesn't work:

$ brew link git
Error: git has multiple installed versions

Instead the fix seems to be to explicitly switch to the last known version.

$ brew switch git
Cleaning /usr/local/Cellar/git/1.7.10
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/1.7.12
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/
Cleaning /usr/local/Cellar/git/1.8.0
Cleaning /usr/local/Cellar/git/
203 links created for /usr/local/Cellar/git/

It looks like I should run 'brew cleanup' more often. But can anything be done to make this more robust?


Indeed, looks like a place to improve. Some check if git is sane.

However, you had a lot of older kegs (i.e. versions) installed in the Cellar, which is another issue brew could improve. Usually brew cleanup helps a bit with removing old versions that are not needed.

I have proposed earlier that brew link git should use the one with the highest version number (and issue a small warning, because some version numbering schemes suck).

If find it strange that fatal: bad config file line 18 in /Users/mblakele/.gitconfig claims the config file is "bad"...
Can you you .gitconfig?


The reason is that because your Homebrew git is not linked, it is using the Xcode-provided git which is too old to recognize the "simple" push option.


I've run brew cleanup and added it to my daily-update script. Not sure why it wasn't there before.

My .gitconfig is 17 lines long, and hasn't changed in 33 days. Normally brew has no problem with it, and I think that's just a symptom of git not working.

$ wc -l /Users/mblakele/.gitconfig
      17 /Users/mblakele/.gitconfig
$ tail /Users/mblakele/.gitconfig
        branch = auto
        status = auto
        diff = auto
        st = status
        ci = commit
        co = checkout
        br = branch
        default = simple

There's not really anything I can think of that can improve this. Homebrew can only relink after failed installs if there is only one other keg (in other words, if there is more than one it doesn't know which one to relink). Coupled with what I noted above, you will see issues until you relink a git that is capable of understanding push.default = simple.


Closing because this isn't something we can control. The risk you take when using cutting-edge git features is that older git won't understand them.

@jacknagel jacknagel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.