dart-lang / homebrew-dart

Dart team's official tap for homebrew.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

brew update throws " couldn't find remote ref refs/heads/master"

iapicca opened this issue · comments

this happens since flutter forward

~ brew update
fatal: couldn't find remote ref refs/heads/master
Error: Fetching /opt/homebrew/Library/Taps/dart-lang/homebrew-dart failed!
Error: Some taps failed to update!
The following taps can not read their remote branches:
  dart-lang/dart
This is happening because the remote branch was renamed or deleted.
Reset taps to point to the correct remote branches by running `brew tap --repair`
~ brew --version
Homebrew 3.6.20
Homebrew/homebrew-core (git revision 482f2727196; last commit 2023-01-27)
Homebrew/homebrew-cask (git revision c3e0e02345; last commit 2023-01-27)~ dart --version
Dart SDK version: 2.19.0 (stable) (Mon Jan 23 11:29:09 2023 -0800) on "macos_arm64"~ flutter doctor -v
[!] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-arm64, locale en-EE)
    • Flutter version 3.7.0 on channel stable at /Users/yakforward/fvm/versions/stable
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/yakforward/fvm/versions/stable. Consider adding
      /Users/yakforward/fvm/versions/stable/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (4 days ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
      perform update checks and upgrades.

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.74.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.2 22D49 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.
                    'c.          yakforward@yakforward.local
                 ,xNMM.          ---------------------------
               .OMMMMo           OS: macOS 13.2 22D49 arm64
               OMMM0,            Host: MacBookAir10,1
     .;loddo:' loolloddol;.      Kernel: 22.3.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 6 hours, 11 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 102 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8.1
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1440x900
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: /dev/ttys000
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M1
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 1372MiB / 8192MiB
       .cooc,.    .,coo:.

A result of #129

Running brew tap --repair dart-lang/dart should resolve:

$ brew tap --repair dart-lang/dart
remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 54 (delta 23), reused 49 (delta 22), pack-reused 0
Unpacking objects: 100% (54/54), 14.03 KiB | 251.00 KiB/s, done.
From https://github.com/dart-lang/homebrew-dart
 * [new branch]      main       -> origin/main
==> dart-lang/dart: changed default branch name from master to main!

After which brew update && brew upgrade dart works.

brew tap --repair dart-lang/dart

it does fix the issue
thanks @miketheman

FYI repair haven't solved that issue for me.

❯ brew tap --repair dart-lang/dart
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git -C /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart fetch origin` exited with 128.

I found that post and tried:

cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart
git branch -m master main
git remote remove origin
git remote add origin https://github.com/dart-lang/homebrew-dart

After that, brew update still failed, but this time brew tap --repair dart-lang/dart solved it.

here we go again

~ brew tap --repair dart-lang/dart
➜  ~ brew update && \
brew upgrade && \
brew upgrade --cask && \
brew cleanup && \
softwareupdate --all --install --force
Already up-to-date.
==> Upgrading 1 outdated package:
dart-lang/dart/dart 2.19.0 -> 2.19.1
==> Fetching dart-lang/dart/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.1/sdk/dartsdk-macos-arm64-release.
curl: (22) The requested URL returned error: 403

Error: dart: Failed to download resource "dart"
Download failed: https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.1/sdk/dartsdk-macos-arm64-release.zip
➜  ~ brew tap --repair dart-lang/dart
➜  ~ brew update
Already up-to-date.

is there a way to permanently fix this?

The last failure, a failure to download the SDK zip file, seems unrelated to the above problems changing master to main.

Could this be a temporary failure? The file is there, and the download of it using curl should succeed.

What really worked for me to fix this issue:

cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart

git branch -m master main
git remote remove origin
git remote add origin https://github.com/dart-lang/homebrew-dart
brew tap --repair dart-lang/dart

brew update

Any idea how to fix this so everyone in the wild has a transparent solution?

This issue happens because the "master" branch was renamed to "main" and brew is totally dependent on git.

This is a SEVERE error, BTW.

@whesse
@kevmoo

FYI repair haven't solved that issue for me.

❯ brew tap --repair dart-lang/dart
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git -C /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart fetch origin` exited with 128.

I found that post and tried:

cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart
git branch -m master main
git remote remove origin
git remote add origin https://github.com/dart-lang/homebrew-dart

After that, brew update still failed, but this time brew tap --repair dart-lang/dart solved it.

Thanks! This fixes the problem I was having as the other proposed solutions were not able to. 🙏

brew is completely broken due to the rename of master to main

AD is now at b0e349efe Merge pull request #15081 from reitermarkus/livecheck-artifacts
fatal: couldn't find remote ref refs/heads/master
Error: Fetching /opt/homebrew/Library/Taps/dart-lang/homebrew-dart failed!
Updated 2 taps (homebrew/core and homebrew/cask).
Error: Some taps failed to update!
The following taps can not read their remote branches:
dart-lang/dart
This is happening because the remote branch was renamed or deleted.
Reset taps to point to the correct remote branches by running brew tap --repair
Failed during: /opt/homebrew/bin/brew update --force --quiet

There are no brew commands available. Fixes suggesting
brew doctor
brew update
brew *

are not workable

What really worked for me to fix this issue:

cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart

git branch -m master main
git remote remove origin
git remote add origin https://github.com/dart-lang/homebrew-dart
brew tap --repair dart-lang/dart

brew update

For now this is the fix