BREW更新:以下未跟踪工作树中的文件将被合并被覆盖:(brew update: The follo

2019-06-24 19:53发布

我试图运行brew update和我,如果我合并我的本地修改错误会丢失。 我试图提交我的本地修改(不记得做任何,但它已经一段时间),这让事情变得更糟。

下面是输出:

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

Answer 1:

不要忘了取原点!

$ cd /usr/local
$ git fetch origin
$ git reset --hard origin/master

说明,对于那些有兴趣:

什么情况是,你要更新冲泡,冲泡但本身或者是不是最新的(可能),有权限通过某些操作系统更新(也有可能)发生变化,或酿造略有损坏(不太可能)。 由于BREW本身就是一个混帐回购协议,则必须更新或重新酿造到主分支版本。 BREW [默认]位于/usr/local文件夹,所以你

  1. 转到该文件夹​​[第一命令],其也应该更新的权限(如果不是见下文)
  2. 取的原点[第二命令],这意味着更新您的酿造的远程分支的本地版本
  3. 硬复位[第三命令]基于所述远程主分支(其也使用您的当前权限)。

您也可以chown的第一个命令,如果你是在非须藤或管理员的个人资料
$ sudo chown -R `whoami` /usr/local
$ cd /usr/local
$ git reset --hard origin/master

要了解git的复位,看看这篇文章 。



Answer 2:

我有一个类似的问题,几个星期前,要更新旧的自制软件安装。 这样做:

git reset --hard origin/master

/usr/local固定对我来说。

它看起来像其他人有过这样的问题了。 你看在任何建议的解决方法在这里 ?



Answer 3:

我加入我个人的经验,因为它似乎比在2012年提出什么更安全一点:

  1. 运行brew doctor
  2. 如果您收到以下警告:

     Warning: The /usr/local directory is not writable. 

    跑:

     sudo chown -R `whoami` /usr/local 

    修复权限问题(由克里斯·弗里西纳建议也)。 最终运行brew doctor再次保证自己的警告了。

  3. 现在,你应该有一个

     Warning: You have uncommitted modifications to Homebrew 

    可以通过贝解决

     cd /usr/local/Library && git stash && git clean -d -f 

    由Dr.Brew本身建议。 该命令藏匿在提交的修改,所以你可以回去,如果需要恢复它们。 这似乎较安全git reset --hard origin/master给我。

  4. 如果你愿意,检查正式排除指南如果此处的步骤建议,并通过其他因此用户不会解决你的问题。



Answer 4:

类似的答案,但如果你有不再跟踪文件,你需要额外的步骤,从/usr/local运行

git fetch origin
git clean -f
git reset --hard origin/master


Answer 5:

这种方法可能比一些简单。 它涉及:

  • 固定git的问题,这样你就可以再次委托更改它的管理。
  • 没有手动文件或目录的移动。
  • 没有文件或目录权限手动调整。

步骤(与那些谁想要解释说明):

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的变化。 它现在brew ,是brew.git 。 (全了最新网址: https://github.com/Homebrew/brew )

注1:第一个命令把你从任何地方在你的文件结构,以正确的目录。 该目录结构比别人以上(的Mac OS 16年11月10日)显示我不同,但与此命令,这些分歧不应该的问题。

注2:此第二个命令添加正确的远程URL到一个新的别名; 我这样做,以防万一这种方法并没有达到我想要的东西,我再次需要以前的地址。 由于新的远程工作,我会邀请其他人发表评论,简单地改变原产别名的URL。 我将愉快地更新的答案,以反映什么对你的工作。

注3:此规定命令到底想要的结果:它报告了大量的更新,包括对特别好的报告“==>迁移HOMEBREW_REPOSITORY到/ usr /本地/家酿!” (强调他们)。



文章来源: brew update: The following untracked working tree files would be overwritten by merge:
标签: git homebrew