error: Not a valid ref: refs/remotes origin /master
试试“set-url”其他源试试。
如果遇到:
1 2
fatal: not a git repository (or any of the parent directories): .git
输入以下命令即可解决。
1 2
git init
如果遇到:
1 2 3 4 5
Error: Could not 'git stash' in /opt/homebrew! Please stash/commit manually if you need to keep your changes or, if not, run: cd /opt/homebrew git reset --hard origin/master
其实解决办法就在报错命令里了:
1 2 3
cd /opt/homebrew git reset --hard origin/master
如果执行:
1 2
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
出现错误:
1 2
cd: no such file or directory: /opt/homebrew/Library/Taps/homebrew/cask
无视即可。可能是因为M1的配置和之前的不一样,没有 cask 这个目录。
执行:
1 2 3 4 5
cd /opt/homebrew/Library/Taps/ mkdir homebrew cd homebrew git clone <https://mirrors.ustc.edu.cn/homebrew-core.git>
Warning: You are running macOS on a arm64 CPU architecture. We do not provide support for this (yet). Reinstall Homebrew under Rosetta 2 until we support it. You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Twitter or any other official channels. You are responsible for resolving any issues you experience while you are running this unsupported configuration.
==> Downloading <https://mirrors.cloud.tencent.com/homebrew-bottles/bottles/icu4c> ######################################################################## 100.0% Error: SHA256 mismatch Expected: 0d03423f2a4a557fc04a021fad963ab71d05b9129693887522dde996aff8c9f9 Actual: e055a567ca6c52d45b0a07cd9c0182591ece5984b20a0a6f1d6dd2e8ed5d3d0a File: /Users/dengjiangling/Library/Caches/Homebrew/downloads/7a6b1f9f807a76760bf7490facaa94b765c3c720fb218cabe5c3f329b3c85ba7--icu4c-67.1.arm64_big_sur.bottle.tar.gz To retry an incomplete download, remove the file above. Warning: Bottle installation failed: building from source. ==> Downloading <https://github.com/unicode-org/icu/commit/715d254a02b0b22681cb6f> ######################################################################## 100.0% ==> Downloading <https://github.com/unicode-org/icu/releases/download/release-67-> ==> Downloading from <https://github-production-release-asset-2e65be.s3.amazonaws> ######################################################################## 100.0% ==> Downloading <https://mirrors.cloud.tencent.com/homebrew-bottles/bottles/node-> ######################################################################## 100.0% ==> Installing dependencies for node: icu4c ==> Installing node dependency: icu4c ==> Pouring icu4c-67.1.arm64_big_sur.bottle.tar.gz ==> Caveats icu4c is keg-only, which means it was not symlinked into /opt/homebrew, because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run: echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set: export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib" export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"