Using GitHub mirrors with Bazel

Using GitHub mirrors with Bazel
Photo by Scott Rodgerson / Unsplash

If you use Bazel for builds, the https://releases.bazel.build and https://bcr.bazel.build certs expired today...and have not yet been renewed (see https://github.com/bazelbuild/bazel/issues/28101). Any builds with Bazel will break because of this. I discovered this myself while working on something and bazel build ... started throwing a cert error.

For a quick workaround, use the Bazel GitHub repositories as a mirrors for releases.bazel.build and bcr.bazel.build.

In .bazeliskrc , put this:

# Mirror for releases.bazel.build
BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download

And in .bazelrc, put this:

# Mirror for bcr.bazel.build 
common --registry=https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/