Skip to content

install.sh: VERSION=prerelease installs an older build than the latest stable release #5547

Backlog

Description

@mohitmishra786

Describe the bug

With VERSION=prerelease, install.sh picks the last tag from git ls-remote --tags --sort "version:refname". Git's version sort puts a release before its own prereleases (v1.0.114 before v1.0.114-0), which is the opposite of semver. So between a stable release and the next -0 prerelease, install.sh installs the last prerelease of that version, which is older than the stable release.

For example, from 2026-11-18 until v1.0.115-0 was tagged, it installed 1.0.114-0 (published 2026-11-17T22:57Z) instead of 1.0.114 (published 2026-11-18T05:59Z). They are different builds: the linux-x64 checksums are 7b7af4a71d0fa4f9... and b91a96f2257297cf....

Affected version

install.sh on main (752496d). The installed CLI was 1.0.114-0.

Steps to reproduce the behavior

The tags as they are now:

$ git ls-remote --tags --sort "version:refname" https://github.com/github/copilot-cli | grep -E 'v1\.0\.11[34]' | awk -F/ '{print $NF}'
v1.0.113
v1.0.113-0
v1.0.113-1
v1.0.114
v1.0.114-0

To run the script against the tag state of 2026-11-18, I put the real tag names, without the v1.0.115-* tags, into a local bare repository and redirected the script's remote to it with url.<base>.insteadOf. The tarball and checksums are still downloaded from the real releases. In ubuntu:24.04 with git 2.43.0:

git init -q --bare /srv/copilot-cli.git
git init -q /tmp/w && cd /tmp/w && git -c user.name=r -c user.email=r@example.invalid commit -q --allow-empty -m x
git ls-remote --tags https://github.com/github/copilot-cli | awk '{print $2}' | sed 's#refs/tags/##' \
  | grep -v '\^{}' | grep -vE '^v1\.0\.115' | while read -r t; do git tag "$t"; done
git push -q /srv/copilot-cli.git --tags
cd /
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=url./srv/copilot-cli.git.insteadOf \
  GIT_CONFIG_VALUE_0=https://github.com/github/copilot-cli
VERSION=prerelease PREFIX=/opt/cp bash install.sh   # install.sh from main
/opt/cp/bin/copilot --version

Output:

Installing GitHub Copilot CLI...
Latest prerelease version: v1.0.114-0
Downloading from: https://github.com/github/copilot-cli/releases/download/v1.0.114-0/copilot-linux-arm64.tar.gz
✓ Checksum validated
✓ GitHub Copilot CLI installed to /opt/cp/bin/copilot
...
GitHub Copilot CLI 1.0.114-0.

Expected behavior

Once 1.0.114 is released, the prerelease channel should not install a build older than it. It should install 1.0.114 until the next prerelease (1.0.115-0) is tagged.

Additional context

Git can sort these the semver way with versionsort.suffix:

$ git -c versionsort.suffix=- ls-remote --tags --sort "version:refname" https://github.com/github/copilot-cli | grep -E 'v1\.0\.11[234]' | awk -F/ '{print $NF}'
v1.0.112-0
v1.0.112
v1.0.113-0
v1.0.113-1
v1.0.113
v1.0.114-0
v1.0.114

With that change, the reproduction above installs 1.0.114, and on the live tags it still picks v1.0.115-5. I can open a PR with this one-line change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:installationInstalling, updating, versioning, PATH setup, and binary distribution

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions