[homebrew] BREW 업데이트 실패 : 추적되지 않은 작업 트리 파일을 병합하여 덮어 씁니다.

Homebrew를 업데이트하려고 brew update하면 다음 오류가 발생합니다.

error: The following untracked working tree files would be overwrittenby merge:
 Library/Formula/argp-standalone.rb
 Library/Formula/cocot.rb
Please move or remove them before you can merge.
Aborting
Updating e088818..5909e2c
Error: Failed while executing git pull  origin refs/heads/master:refs/remotes/origin/master

Mountain Lion을 설치 한 후 비슷한 문제가 발생한 사람이 블로그 게시물을 찾았습니다 (이번 주에도 했음). 그는 오류 메시지에 언급 된 파일을 어떻게 제거했는지 설명합니다.

I removed these files:
$ cd $(brew --prefix)
$ rm cocot.rb
However, removing these files didn't help with the brew update. Instead I had to manually update brew through git:
$ cd $(brew --prefix)
$ git fetch origin
$ git reset --hard origin/master
$ brew update
Already up-to-date.

그 지시 사항이 정확하다고 가정하면 (어쩌면 가정해서는 안 됨)이 지시 사항을 따르려고했습니다.

    $ cd $(brew --prefix)
    $ rm cocot.rb

그러나 cocot.rb를 rm하려고 할 때 ‘파일이 없습니다’라고 말했습니다.

확실하지 않은 한 가지는 cd $(brew --prefix)입력 한 정확한 단어입니까 아니면 접두사를 다른 것으로 바꿔야합니까? CD가 성공적이므로 CD가 정확하다고 가정합니다 ./usr/local로 이동했지만 제거 할 파일이 없습니다. / usr / local의 내용은

Cellar              clamXav             git             mysql               var Library             doc             heroku              mysql-5.5.15-osx10.6-x86_64 README.md           etc             include             rvm bin             foreman             lib             share

어쨌든 ‘brew update’를 수정하는 방법을 알고 있습니까

업데이트 : favoretti의 지침에 따라 파일을 제거하고 시도한 chown -R <your_username> $(brew --prefix)/.git후 다음 오류가 발생했습니다.brew update

error: The following untracked working tree files would be overwritten by merge:
    Library/Aliases/gperftools
    Library/Aliases/hashdeep
    Library/Aliases/htop
    Library/Aliases/nodejs
    Library/Aliases/ocio
    Library/Aliases/oiio
    Library/Aliases/pgrep
    Library/Aliases/pkill
    Library/Aliases/qt4
    Library/Aliases/twolame
    Library/Aliases/wxwidgets
    Library/Contributions/cmds/brew-aspell-dictionaries
    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-ls-taps.rb
    Library/Contributions/cmds/brew-man
    Library/Contributions/cmds/brew-md5-to-sha1
    Library/Contributions/cmds/brew-mirror-check.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.rb
    Library/Contributions/cmds/brew-tests.rb
    Library/Contributions/cmds/brew-unpack.rb
    Library/Contributions/cmds/brew-which.rb
    Library/Contributions/cmds/git
    Library/Contributions/cmds/svn
    Library/ENV/4.3/apr-1-config
    Library/ENV/4.3/bsdmake
    Library/ENV/4.3/c++
    Library/ENV/4.3/c89
    Library/ENV/4.3/c99
    Library/ENV/4.3/cc
    Library/ENV/4.3/clang
    Library/ENV/4.3/clang++
    Library/ENV/4.3/cpp
    Library/ENV/4.3/g++
    Library/ENV/4.3/gcc
    Library/ENV/4.3/git
    Library/ENV/4.3/i686-apple-darwin11-llvm-g++-4.2
    Library/ENV/4.3/i686-apple-darwin11-llvm-gcc-4.2
    Library/ENV/4.3/ld
    Library/ENV/4.3/llvm-g++
    Library/ENV/4.3/llvm-g++-4.2
    Library/ENV/4.3/llvm-gcc
    Library/ENV/4.3/llvm-gcc-4.2
    Library/ENV/4.3/make
    Library/ENV/4.3/mig
    Library/ENV/4.3/sed
    Library/ENV/4.3/svn
    Library/ENV/4.3/xcrun
    Library/ENV/libsuperenv.rb
    Library/ENV/pkgconfig/leopard/libcrypto.pc
    Library/ENV/pkgconfig/leopard/libcurl.pc
    Library/ENV/pkgconfig/mountain_lion/libcurl.pc
    Library/ENV/pkgconfig/mountain_lion/libexslt.pc
    Library/ENV/pkgconfig/mountain_lion/libxml-2.0.pc
    Library/ENV/pkgconfig/mountain_lion/libxslt.pc
    Library/Formula/abcl.rb
    Library/Formula/abcmidi.rb
    Library/Formula/aiccu.rb
    Library/Formula/akka.rb
    Library/Formula/alac.rb
    Library/Formula/alure.rb
    Library/Formula/appledoc.rb
    Library/Formula/arangodb.rb
    Library/Formula/argp-standalone.rb
    Library/Formula/argtable.rb
    Library/Formula/autopano-sift-c.rb
    Library/Formula/avian.rb
    Library/Formula/avidemux.rb
    Library/Formula/avro-cpp.rb
    Library/Formula/aws-cloudsearch.rb
    Library/Formula/aws-sns-cli.rb
    Library/Formula/backupninja.rb
    Library/Formula/bact.rb
    Library/Formula/bam.rb
    Library/Formula/basex.rb
    Library/Formula/berkeley-db4.rb
    Library/Formula/bind.rb
    Library/Formula/blazeblogger.rb
    Library/Formula/bochs.rb
    Library/Formula/boost149.rb
    Library/Formula/bsdconv.rb
    Library/Formula/bsdmake.rb
    Library/Formula/buildapp.rb
    Library/Formula/bup.rb
    Library/Formula/byacc.rb
    Library/Formula/cadubi.rb
    Library/Formula/camellia.rb
    Library/Formula/casperjs.rb
    Library/Formula/ccextractor.rb
    Library/Formula/cconv.rb
    Library/Formula/cdo.rb
    Library/Formula/cdpr.rb
    Library/Formula/cgvg.rb
    Library/Formula/checkstyle.rb
    Library/Formula/chordii.rb
    Library/Formula/chruby.rb
    Library/Formula/cifer.rb
    Library/Formula/clhep.rb
    Library/Formula/cntlm.rb
    Library/Formula/cocot.rb
    Library/Formula/cogl.rb
    Library/Formula/collada-dom.rb
    Library/Formula/crash.rb
    Library/Formula/crossroads.rb
    Library/Formula/crosstool-ng.rb
    Library/Formula/css-crush.rb
    Library/Formula/csync.rb
    Library/Formula/ctemplate.rb
    Library/Formula/curlftpfs.rb
    Library/Formula/cutter.rb
    Library/Formula/cvsutils.rb
    Library/Formula/darkstat.rb
    Library/Formula/darner.rb
    Library/Formula/dart.rb
    Library/Formula/dasm.rb
    Library/Formula/debianutils.rb
    Library/Formula/dfc.rb
    Library/Formula/dgtal.rb
    Library/Formula/dhcping.rb
    Library/Formula/di.rb
    Library/Formula/dmtx-utils.rb
    Library/Formula/drip.rb
    Library/Formula/dsniff.rb
    Library/Fo
Aborting
Updating e088818..c1fbc29
Error: Failed while executing git pull  origin refs/heads/master:refs/remotes/origin/master



답변

cd $(brew --prefix)
git reset --hard HEAD
brew update


답변

다음을 수행해야합니다.

cd $(brew --prefix)
rm Library/Formula/argp-standalone.rb
rm Library/Formula/cocot.rb

그리고 나서

git fetch origin
git reset --hard origin/master
brew update

기본적으로 조금 더 설명하려면 :

cd $(brew --prefix)

cd디렉토리를 brew --prefix출력 할 내용으로 변경하도록 지시 합니다 . brew --prefix명령을 실행하려고하면 다음과 같은 내용이 표시됩니다.

brew --prefix
/usr/local

따라서이 경우 명령은에 해당 cd /usr/local합니다. 최신 brew버전은 설치 접두사 아래에 수식이 있습니다.Library/Formula/ 있으므로 구식 / 변경된 파일을 찾아야합니다.

버전 고정과 같은 특정 이유로 인해 수식을 직접 변경 한 경우이 작업을 수행하면 수식이 기본 수식으로 되돌아 가서 원치 않는 효과가 발생할 수 있습니다.

@TedPennings는 주석에서 이것이 효과가 있었지만 그의 순서는 다음과 같습니다.

  1. 모든 것을 씹다 my_username:admin , 즉,sudo chown -R ted:admin $(brew --prefix)
  2. 위의 두 가지 git 명령을 실행 git fetch origin하고git reset --hard origin/master

답변

이것은 update오랫동안 수정 된 코드 의 오래된 버그로 인해 발생합니다 . 그러나 버그의 특성상 다음을 수행해야합니다.

cd $(brew --repository)
git reset --hard FETCH_HEAD

brew doctor커밋되지 않은 수정에 대해 여전히 불평이 있으면 다음 명령도 실행하십시오.

cd $(brew --repository)
git clean -fd


답변

$ cd $(brew --prefix)
$ git clean -fd
$ git reset --hard
$ sudo chown -R `whoami` `brew --prefix`
$ brew update

참고 : 오류가 발생하기 전에 4 전에 5 단계를 수행 한 이후 2 & 3 단계가 저에게 효과적이었습니다. 양조 갱신 폴더의 소유자를 변경하기 전에 전체 문제를 일으켰습니다.


답변

BREW 패키지 라이브러리가 루트 사용자로 다운로드 된 비슷한 문제가 있었고 git이 파일을 병합 할 수 없다는 불만 때문에 BREW 업데이트를 실행할 수 없었습니다.

해결책은 다음과 같습니다.

sudo chown -R <user> /usr/local/Library


답변

적용된 수식에서 잠재적 인 수정을 버리지 않으려면 추출 저장소를 재설정하는 것이 가장 효율적인 방법이어야합니다.

$ cd `brew --prefix`
$ git fetch origin
$ git reset --hard origin/master
$ brew cleanup --force
$ brew update


답변

이 경로에 관리자 그룹 쓰기 및 setgid 비트 권한을 추가하여 내 컴퓨터 에서이 문제를 해결할 수있었습니다.

sudo chmod -R g+ws /usr/local /Library/Caches/Homebrew

s는 다음 번에 다른 관리자가 Homebrew를 업데이트하거나 업그레이드 할 때 쓰기 권한이 손실되지 않도록 실행시 그룹 ID를 설정합니다.

brew cleanup --forceHomebrew가 / usr / local / Cellar /에서 콘텐츠를 제거하려고 할 때 권한 문제가 있기 때문에이 답변은 다소 불완전 합니다. (불행히도 현재로서는 더 이상 조사 할 수 없습니다.)