Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iapicca opened this issue Jan 27, 2023 · 16 comments
Closed

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

iapicca opened this issue Jan 27, 2023 · 16 comments

Comments

@iapicca
Copy link

iapicca commented Jan 27, 2023

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.          [email protected]
                 ,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:.
@miketheman
Copy link

A result of #129

@miketheman
Copy link

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.

@iapicca
Copy link
Author

iapicca commented Jan 27, 2023

brew tap --repair dart-lang/dart

it does fix the issue
thanks @miketheman

@iapicca iapicca closed this as completed Jan 27, 2023
@Najki
Copy link

Najki commented Jan 31, 2023

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.

@iapicca iapicca reopened this Feb 2, 2023
@iapicca
Copy link
Author

iapicca commented Feb 2, 2023

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?

@whesse
Copy link
Contributor

whesse commented Feb 2, 2023

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.

@gmpassos
Copy link

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

@gmpassos
Copy link

gmpassos commented Feb 13, 2023

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

@fajarvm
Copy link

fajarvm commented Feb 18, 2023

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. 🙏

@CuchulainX
Copy link

CuchulainX commented Mar 30, 2023

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

@gmpassos
Copy link

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

@athomas
Copy link
Member

athomas commented Jun 14, 2023

Assuming that users have used the workaround described here. If you're still facing issues, please report them to the homebrew team.

@athomas athomas closed this as completed Jun 14, 2023
@CuchulainX
Copy link

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

This also effects new installs of brew
I needed to:

cd /opt/Homebrew/Library/Taps/dart-lang/homebrew-dart
git fetch
git checkout main
git checkout -b master

then I was able to execute
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

@kevmoo
Copy link
Member

kevmoo commented Jul 13, 2023

@athomas – thoughts?

@gmpassos
Copy link

The problem has not been fully fixed for 6 months (and this issue is closed for 5 months, BTW)

@athomas
Copy link
Member

athomas commented Jul 14, 2023

This also effects new installs of brew

I created a new GitHub Actions workflow and it installs fine using the official instructions from dart.dev:
https://github.com/dart-lang/homebrew-dart/actions/runs/5553515999/jobs/10142152664

Anything I'm missing? Perhaps you had an old cache?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants