First, check the brew update upgrade information
brew update –verbose –force
fatal: Needed a single revision
Previously modified the source, resulting in 416, GIT update failed
Reset all sources
Reset brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
Reset homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
brew update –verbose –force
then
Updating /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
fatal: Needed a single revision
need to goto /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask
git pull
From https://github.com/Caskroom/homebrew-cask
* branch HEAD -> FETCH_HEAD
Re-execute brew update to restore normal.
Continue brew search opencv2
to find 2 libraries normally.
brew install opencv@2