brew update: The following untracked working tree files would be overwritten by merge:
我试着运行
输出结果如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | MBP:Library User$ sudo brew update error: The following untracked working tree files would be overwritten by merge: Library/Aliases/fastcgi Library/Aliases/htop Library/Aliases/nodejs Library/Aliases/ocio Library/Aliases/oiio Library/Aliases/pgrep Library/Aliases/pkill Library/Contributions/cmds/brew-beer.rb Library/Contributions/cmds/brew-dirty.rb Library/Contributions/cmds/brew-graph Library/Contributions/cmds/brew-grep Library/Contributions/cmds/brew-leaves.rb Library/Contributions/cmds/brew-linkapps.rb Library/Contributions/cmds/brew-man Library/Contributions/cmds/brew-mirror-check.rb Library/Contributions/cmds/brew-missing.rb Library/Contributions/cmds/brew-pull.rb Library/Contributions/cmds/brew-readall.rb Library/Contributions/cmds/brew-server Library/Contributions/cmds/brew-services.rb Library/Contributions/cmds/brew-switch.rb Library/Contributions/cmds/brew-test-bot.commit.html.erb Library/Contributions/cmds/brew-test-bot.css Library/Contributions/cmds/brew-test-bot.index.html.erb Library/Contributions/cmds/brew-test-bot.rb Library/Contributions/cmds/brew-tests.rb Library/Contributions/cmds/brew-unpack.rb Library/Contributions/cmds/brew-which.rb Library/Contributions/install_homebrew.rb Library/Formula/abcl.rb Library/Formula/abyss.rb Library/Formula/akka.rb Library/Formula/apollo.rb Library/Formula/appledoc.rb Library/Formula/arangodb.rb Library/Formula/autoconf.rb Library/Formula/automake.rb Library/Formula/avidemux.rb Library/Formula/bind.rb Library/Formula/bsdconv.rb Library/Formula/bsdmake.rb Library/Formula/camellia.rb Library/Formula/cbmbasic.rb Library/Formula/cdo.rb Library/Formula/checkstyle.rb Library/Formula/cifer.rb Library/Formula/clhep.rb Library/Formula/collada-dom.rb Library/Formula/crash.rb Library/Formula/crossroads.rb Library/Formula/css-crush.rb Library/Formula/curlftpfs.rb Library/Formula/dart.rb Library/Formula/dasm.rb Library/Formula/dfc.rb Library/Formula/di.rb Library/Formula/dsniff.rb Library/Formula/dupx.rb Library/Formula/dwatch.rb Library/Formula/eprover.rb Library/Formula/ext2fuse.rb Library/Formula/ezlupdate.rb Library/Formula/f3.rb Library/Formula/fastx_toolkit.rb Library/Formula/fceux.rb Library/Formula/findbugs.rb Library/Formula/freerdp.rb Library/Formula/funcoeszz.rb Library/Formula/fwknop.rb Library/Formula/gabedit.rb Library/Formula/gbdfed.rb Library/Formula/gconf.rb Library/Formula/git-encrypt.rb Library/Formula/glm.rb Library/Formula/gmap-gsnap.rb Library/Formula/gnu-arch.rb Library/Formula/gnunet.rb Library/Formula/gobby.rb Library/Formula/gptfdisk.rb Library/Formula/griffon.rb Library/Formula/grok.rb Library/Formula/gtk-chtheme.rb Library/Formula/gtkglextmm.rb Library/Formula/gtmess.rb Library/Formula/hg-flow.rb Library/Formula/hqx.rb Library/Formula/htop-osx.rb Library/Formula/htpdate.rb Library/Formula/imap-uw.rb Library/Formula/iozone.rb Library/Formula/ipbt.rb Library/Formula/ipe.rb Library/Formula/ispc.rb Library/Formula/ispell.rb Library/Formula/jigdo.rb Library/Formula/jing.rb Library/Formula/jless.rb Library/Formula/jpeginfo.rb Library/Formula/konoha.rb Library/Formula/legit.rb Library/Formula/libcouchbase.rb Library/Formula/libcuefile.rb Library/Formula/libextractor.rb Library/Formula/libglademm.rb Library/Formula/libgtextutils.rb Library/Formula/libinfinity.rb Library/Formula/libkate.rb Library/Formula/libqalculate.rb Library/Formula/libqglviewer.rb Library/Formula/libreplaygain.rb Library/Formula/libtool.rb Library/Formula/libvbucket.rb Library/Formula/libvo-aacenc.rb Library/Formula/libxmi.rb Library/Formula/lifelines.rb Library/Formula/makeicns.rb Library/Formula/mathgl.rb Library/Formula/meld.rb Library/Formula/mesalib-glw.rb Library/Formula/minisat.rb Library/Formula/minuit2.rb Library/Formula/mobile-shell.rb Library/Formula/movgrab.rb Library/Formula/mp3cat.rb Library/Formula/mpich2.rb Library/Formula/mrfast.rb Library/Formula/musepack.rb Library/Formula/ndiff.rb Library/Formula/net6.rb Library/Formula/nrpe.rb Library/Formula/nuttcp.rb Library/Formula/oath-toolkit. Updating aa07533..3f070ef Aborting Error: Failed while executing git pull origin refs/heads/master:refs/remotes/origin/master |
别忘了取原点!!!!
$
解释,对于感兴趣的人:
发生的情况是,您试图更新BREW,但BREW本身不是最新的(可能),通过某些操作系统更新(也可能),权限发生了更改,或者BREW有点损坏(不太可能)。由于BREW本身是一个git repo,因此必须将BREW更新或重置为主分支版本。BREW[默认]位于
如果您在非sudo或管理配置文件中,也可以使用cx1〔5〕第一个命令。$
要了解Git重置,请看本文。
几周前我也遇到过类似的问题,我试图更新一个旧的自制安装。执行此操作:
1 | git reset --hard origin/master |
在江户记1〔0〕为我修的。
似乎其他人也有这个问题。你看过这里提议的任何解决办法吗?
我正在增加我的个人经验,因为它似乎比2012年提出的建议更安全:
如果收到以下警告:
1 | Warning: The /usr/local directory is not writable. |
号
运行:
1 | sudo chown -R `whoami` /usr/local |
解决权限问题(Chris Frisina也建议)。最后再次运行
现在,你应该有一个
1 | Warning: You have uncommitted modifications to Homebrew |
。
也许可以通过
1 | cd /usr/local/Library && git stash && git clean -d -f |
正如Brew博士自己所建议的。该命令存储未提交的修改,以便在需要时返回并恢复它们。对我来说,这似乎比江户十一〔三〕更安全。
如果您愿意,请查看官方的故障排除指南,查看此处和其他人建议的步骤,这样用户就不会解决您的问题。
这种方法可能比某些方法简单。它包括:
- 修复Git问题,以便您可以再次将更改管理委托给它。
- 没有手动移动文件或目录。
- 没有手动调整文件或目录权限。
步骤(为需要解释的人提供注释):
1 2 3 4 | cd $(brew --repository) // see Note 1 below git remote add brew https://github.com/Homebrew/brew // see Note 2 below git pull brew master // promising fast-forward report! brew update // see Note 3 below |
。
概述:据我所知,这个问题的实际原因是回购URL发生了变化。现在是
注意1:第一个命令将您从文件结构中的任何位置带到正确的目录。对于我来说,目录结构与上面显示的不同(Mac OS 10.11.16),但是使用这个命令,这些差异应该不重要。
注意2:第二个命令将正确的远程URL添加到一个新的别名中;我这样做只是为了防止这种方法没有达到我想要的效果,并且我再次需要以前的地址。由于新的遥控器工作正常,我将邀请其他人对简单地更改按来源别名命名的URL进行评论。我会很高兴地更新答案,以反映对您有用的内容。
注3:此fourth命令正好具有所需的结果:它报告了大量更新,包括"=>迁移的homebrew_repository to/usr/local/homebrew!"的特别好的报告。(强调他们的)。
类似的答案,但如果您有不再被跟踪的文件,则需要额外的步骤,以便从
1 2 3 | git fetch origin git clean -f git reset --hard origin/master |
。