From 1190c65796ddb7eaf0c9e7df1163bd544590b537 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 17:20:36 +0000 Subject: [PATCH 01/24] Add installation script --- install.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..f3d72a4a --- /dev/null +++ b/install.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +set -e + +# GitHub Copilot CLI Installation Script +# Usage: curl -fsSL https://gh.io/copilot-install | bash +# or: wget -qO- https://gh.io/copilot-install | bash + +INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}" + +echo "Installing GitHub Copilot CLI..." + +# Detect platform +case "$(uname -s)" in + Darwin*) PLATFORM="darwin" ;; + Linux*) PLATFORM="linux" ;; + *) echo "Error: Unsupported platform $(uname -s). For Windows, recommend using: winget install GitHub.Copilot" >&2 ; exit 1 ;; +esac + +# Detect architecture +case "$(uname -m)" in + x86_64|amd64) ARCH="x64" ;; + aarch64|arm64) ARCH="arm64" ;; + *) echo "Error: Unsupported architecture $(uname -m)" >&2 ; exit 1 ;; +esac + +DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz" +echo "Downloading from: $DOWNLOAD_URL" + +DOWNLOAD_DIR="${HOME}/.copilot/" +mkdir -p "$DOWNLOAD_DIR" + +# Download and extract +cd "$DOWNLOAD_DIR" +if command -v curl >/dev/null 2>&1; then + curl -fsSL "$DOWNLOAD_URL" | tar -xz +elif command -v wget >/dev/null 2>&1; then + wget -qO- "$DOWNLOAD_URL" | tar -xz +else + echo "Error: Neither curl nor wget found. Please install one of them." + exit 1 +fi + +if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then + PREFIX="${PREFIX:-/usr/local}" +else + PREFIX="${PREFIX:-$HOME/.local}" + mkdir -p "$INSTALL_DIR/bin" +fi +INSTALL_DIR="$PREFIX/bin" + +# Install binary +if [ -f "copilot" ]; then + mv copilot "$INSTALL_DIR/copilot" + chmod +x "$INSTALL_DIR/copilot" + echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" +else + echo "Error: copilot binary not found in tarball" + exit 1 +fi + +# Check if install directory is in PATH +if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then + echo "" + echo "Warning: $INSTALL_DIR is not in your PATH" + echo "Add it to your PATH by adding this line to your shell profile:" + echo " export PATH=\"\$PATH:$INSTALL_DIR\"" +fi + +echo "" +echo "Installation complete! Run 'copilot help' to get started." From bbcca4aa2c7843514947a316796b32e50ef29a1b Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 17:32:58 +0000 Subject: [PATCH 02/24] Update installation instructions --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd246de0..3b6407a9 100644 --- a/README.md +++ b/README.md @@ -39,18 +39,34 @@ If you have access to GitHub Copilot via your organization or enterprise, you ca ### Installation -Install globally with npm: +#### Any platform with npm ```bash npm install -g @github/copilot ``` +#### macOS and Linux + +```bash +curl -fsSL https://gh.io/copilot-install | bash +``` + +Or + +```bash +wget -qO- https://gh.io/copilot-install | bash +``` + +#### macOS + Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli): ```bash brew install copilot-cli ``` +#### Windows + Install with [WinGet](https://github.com/microsoft/winget-cli): ```bash From d9c501866314e6d0ea7103d8363335b60c1f5778 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:42:53 -0500 Subject: [PATCH 03/24] Clean up leftover install dir --- install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/install.sh b/install.sh index f3d72a4a..c59e331b 100755 --- a/install.sh +++ b/install.sh @@ -5,8 +5,6 @@ set -e # Usage: curl -fsSL https://gh.io/copilot-install | bash # or: wget -qO- https://gh.io/copilot-install | bash -INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}" - echo "Installing GitHub Copilot CLI..." # Detect platform From cf6859ae33469fa0392b22d1ebbbdf4e846a9c57 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:43:26 -0500 Subject: [PATCH 04/24] Grammar --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c59e331b..acd0ca86 100755 --- a/install.sh +++ b/install.sh @@ -11,7 +11,7 @@ echo "Installing GitHub Copilot CLI..." case "$(uname -s)" in Darwin*) PLATFORM="darwin" ;; Linux*) PLATFORM="linux" ;; - *) echo "Error: Unsupported platform $(uname -s). For Windows, recommend using: winget install GitHub.Copilot" >&2 ; exit 1 ;; + *) echo "Error: Unsupported platform $(uname -s). For Windows, we recommend using: winget install GitHub.Copilot" >&2 ; exit 1 ;; esac # Detect architecture From 4e028d9a49ff1e068b7ddb4d5d6ad5a969c687ed Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:44:09 -0500 Subject: [PATCH 05/24] Remove duplicate trailing slash --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index acd0ca86..1626da39 100755 --- a/install.sh +++ b/install.sh @@ -24,7 +24,7 @@ esac DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz" echo "Downloading from: $DOWNLOAD_URL" -DOWNLOAD_DIR="${HOME}/.copilot/" +DOWNLOAD_DIR="${HOME}/.copilot" mkdir -p "$DOWNLOAD_DIR" # Download and extract From 56c9ed88912f909f6cca521ceb5e170a6b80394f Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:45:38 -0500 Subject: [PATCH 06/24] Use tar -C instead of cd --- install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 1626da39..4da07b20 100755 --- a/install.sh +++ b/install.sh @@ -28,11 +28,10 @@ DOWNLOAD_DIR="${HOME}/.copilot" mkdir -p "$DOWNLOAD_DIR" # Download and extract -cd "$DOWNLOAD_DIR" if command -v curl >/dev/null 2>&1; then - curl -fsSL "$DOWNLOAD_URL" | tar -xz + curl -fsSL "$DOWNLOAD_URL" | tar -xz -C "$DOWNLOAD_DIR" elif command -v wget >/dev/null 2>&1; then - wget -qO- "$DOWNLOAD_URL" | tar -xz + wget -qO- "$DOWNLOAD_URL" | tar -xz -C "$DOWNLOAD_DIR" else echo "Error: Neither curl nor wget found. Please install one of them." exit 1 From f5f4c27f7d2c5376e7792605b5d590c6cf094d68 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:48:36 -0500 Subject: [PATCH 07/24] Always run mkdirp on install dir --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 4da07b20..a42d58cf 100755 --- a/install.sh +++ b/install.sh @@ -41,9 +41,9 @@ if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then PREFIX="${PREFIX:-/usr/local}" else PREFIX="${PREFIX:-$HOME/.local}" - mkdir -p "$INSTALL_DIR/bin" fi INSTALL_DIR="$PREFIX/bin" +mkdir -p "$INSTALL_DIR" # Install binary if [ -f "copilot" ]; then From 82b6ca75336bcf8ae5507ab541e8051c2e8559f5 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 12:50:20 -0500 Subject: [PATCH 08/24] Fix download path check --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index a42d58cf..09308bc4 100755 --- a/install.sh +++ b/install.sh @@ -46,8 +46,8 @@ INSTALL_DIR="$PREFIX/bin" mkdir -p "$INSTALL_DIR" # Install binary -if [ -f "copilot" ]; then - mv copilot "$INSTALL_DIR/copilot" +if [ -f "$DOWNLOAD_DIR/copilot" ]; then + mv "$DOWNLOAD_DIR/copilot" "$INSTALL_DIR/copilot" chmod +x "$INSTALL_DIR/copilot" echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" else From 5bf6153eff0c6284084db4f349e08d2b463d5e95 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:05:56 -0500 Subject: [PATCH 09/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 09308bc4..f75910ee 100755 --- a/install.sh +++ b/install.sh @@ -47,7 +47,7 @@ mkdir -p "$INSTALL_DIR" # Install binary if [ -f "$DOWNLOAD_DIR/copilot" ]; then - mv "$DOWNLOAD_DIR/copilot" "$INSTALL_DIR/copilot" + mv -f "$DOWNLOAD_DIR/copilot" "$INSTALL_DIR/copilot" chmod +x "$INSTALL_DIR/copilot" echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" else From 7c75e1748ac7ea490931537d7102f86d1ff868e0 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:06:32 -0500 Subject: [PATCH 10/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index f75910ee..67af8e7d 100755 --- a/install.sh +++ b/install.sh @@ -56,12 +56,15 @@ else fi # Check if install directory is in PATH -if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then - echo "" - echo "Warning: $INSTALL_DIR is not in your PATH" - echo "Add it to your PATH by adding this line to your shell profile:" - echo " export PATH=\"\$PATH:$INSTALL_DIR\"" -fi +case ":$PATH:" in + *":$INSTALL_DIR:"*) ;; + *) + echo "" + echo "Warning: $INSTALL_DIR is not in your PATH" + echo "Add it to your PATH by adding this line to your shell profile:" + echo " export PATH=\"\$PATH:$INSTALL_DIR\"" + ;; +esac echo "" echo "Installation complete! Run 'copilot help' to get started." From b344a06b4a6c6dd2c8654190b57c04baa634666f Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:09:05 -0500 Subject: [PATCH 11/24] Document PREFIX --- README.md | 3 +++ install.sh | 2 ++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 3b6407a9..61bb9953 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,9 @@ Or wget -qO- https://gh.io/copilot-install | bash ``` +Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` +when run as root or `$HOME/.local` when run as a non-root user. + #### macOS Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli): diff --git a/install.sh b/install.sh index 67af8e7d..d3fdcef2 100755 --- a/install.sh +++ b/install.sh @@ -4,6 +4,8 @@ set -e # GitHub Copilot CLI Installation Script # Usage: curl -fsSL https://gh.io/copilot-install | bash # or: wget -qO- https://gh.io/copilot-install | bash +# Set PREFIX to install to $PREFIX/bin/ directory (default: /usr/local for root, +# $HOME/.local for non-root) echo "Installing GitHub Copilot CLI..." From a77f4454d3d2a814c82016b0ff6ae446b99ae84e Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:10:17 -0500 Subject: [PATCH 12/24] Reorder for clarity maybe --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 61bb9953..3209a274 100644 --- a/README.md +++ b/README.md @@ -45,21 +45,14 @@ If you have access to GitHub Copilot via your organization or enterprise, you ca npm install -g @github/copilot ``` -#### macOS and Linux - -```bash -curl -fsSL https://gh.io/copilot-install | bash -``` +#### Windows -Or +Install with [WinGet](https://github.com/microsoft/winget-cli): ```bash -wget -qO- https://gh.io/copilot-install | bash +winget install GitHub.Copilot ``` -Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` -when run as root or `$HOME/.local` when run as a non-root user. - #### macOS Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli): @@ -68,14 +61,21 @@ Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli): brew install copilot-cli ``` -#### Windows +#### macOS and Linux -Install with [WinGet](https://github.com/microsoft/winget-cli): +```bash +curl -fsSL https://gh.io/copilot-install | bash +``` + +Or ```bash -winget install GitHub.Copilot +wget -qO- https://gh.io/copilot-install | bash ``` +Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` +when run as root or `$HOME/.local` when run as a non-root user. + ### Launching the CLI ```bash From 69905354a947b008875774f6f747da91720111a4 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:10:48 -0500 Subject: [PATCH 13/24] Error to stderr --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index d3fdcef2..d49d41e3 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ if command -v curl >/dev/null 2>&1; then elif command -v wget >/dev/null 2>&1; then wget -qO- "$DOWNLOAD_URL" | tar -xz -C "$DOWNLOAD_DIR" else - echo "Error: Neither curl nor wget found. Please install one of them." + echo "Error: Neither curl nor wget found. Please install one of them." >&2 exit 1 fi From 673aef01fddb3153f126a6bf66743ecdb8c218c7 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:14:14 -0500 Subject: [PATCH 14/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index d49d41e3..df82c417 100755 --- a/install.sh +++ b/install.sh @@ -29,16 +29,26 @@ echo "Downloading from: $DOWNLOAD_URL" DOWNLOAD_DIR="${HOME}/.copilot" mkdir -p "$DOWNLOAD_DIR" -# Download and extract +# Download and extract with error handling +TMP_TARBALL="$(mktemp)" if command -v curl >/dev/null 2>&1; then - curl -fsSL "$DOWNLOAD_URL" | tar -xz -C "$DOWNLOAD_DIR" + curl -fsSL "$DOWNLOAD_URL" -o "$TMP_TARBALL" elif command -v wget >/dev/null 2>&1; then - wget -qO- "$DOWNLOAD_URL" | tar -xz -C "$DOWNLOAD_DIR" + wget -qO "$TMP_TARBALL" "$DOWNLOAD_URL" else - echo "Error: Neither curl nor wget found. Please install one of them." >&2 + echo "Error: Neither curl nor wget found. Please install one of them." exit 1 fi +# Check that the file is a valid tarball +if ! tar -tzf "$TMP_TARBALL" >/dev/null 2>&1; then + echo "Error: Downloaded file is not a valid tarball or is corrupted." + rm -f "$TMP_TARBALL" + exit 1 +fi + +tar -xz -C "$DOWNLOAD_DIR" -f "$TMP_TARBALL" +rm -f "$TMP_TARBALL" if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then PREFIX="${PREFIX:-/usr/local}" else From 01b4b1175ae8ae0d008731bee0b9d7927014ad97 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:15:26 -0500 Subject: [PATCH 15/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index df82c417..4ef00d80 100755 --- a/install.sh +++ b/install.sh @@ -55,7 +55,11 @@ else PREFIX="${PREFIX:-$HOME/.local}" fi INSTALL_DIR="$PREFIX/bin" -mkdir -p "$INSTALL_DIR" +if ! mkdir -p "$INSTALL_DIR"; then + echo "Error: Could not create directory $INSTALL_DIR. You may not have write permissions." >&2 + echo "Try running this script with sudo or set PREFIX to a directory you own (e.g., export PREFIX=\$HOME/.local)." >&2 + exit 1 +fi # Install binary if [ -f "$DOWNLOAD_DIR/copilot" ]; then From fa43ed3ee63873e1c196b6c89eec0d81fb17919b Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:26:59 -0500 Subject: [PATCH 16/24] Clarify --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 4ef00d80..443c22b8 100755 --- a/install.sh +++ b/install.sh @@ -4,8 +4,9 @@ set -e # GitHub Copilot CLI Installation Script # Usage: curl -fsSL https://gh.io/copilot-install | bash # or: wget -qO- https://gh.io/copilot-install | bash -# Set PREFIX to install to $PREFIX/bin/ directory (default: /usr/local for root, -# $HOME/.local for non-root) +# Export PREFIX to install to $PREFIX/bin/ directory (default: /usr/local for +# root, $HOME/.local for non-root), e.g., export PREFIX=$HOME/custom to install +# to $HOME/custom/bin echo "Installing GitHub Copilot CLI..." From 6f305784aa8ca436d3bcd18aa396746ae70653ec Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:28:58 -0500 Subject: [PATCH 17/24] Add notice --- install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.sh b/install.sh index 443c22b8..cc3bad00 100755 --- a/install.sh +++ b/install.sh @@ -64,6 +64,9 @@ fi # Install binary if [ -f "$DOWNLOAD_DIR/copilot" ]; then + if [ -f "$INSTALL_DIR/copilot" ]; then + echo "Notice: Replacing copilot binary found at $INSTALL_DIR/copilot." + fi mv -f "$DOWNLOAD_DIR/copilot" "$INSTALL_DIR/copilot" chmod +x "$INSTALL_DIR/copilot" echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" From 8edeb1732486e738aa2098f9a588714399251c3e Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:30:01 -0500 Subject: [PATCH 18/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index cc3bad00..ce806aba 100755 --- a/install.sh +++ b/install.sh @@ -71,7 +71,7 @@ if [ -f "$DOWNLOAD_DIR/copilot" ]; then chmod +x "$INSTALL_DIR/copilot" echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" else - echo "Error: copilot binary not found in tarball" + echo "Error: copilot binary not found in tarball" >&2 exit 1 fi From 433ff3249abcfa2d5da2c8a88b8255645877f99b Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:30:23 -0500 Subject: [PATCH 19/24] Update install.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index ce806aba..67aa3949 100755 --- a/install.sh +++ b/install.sh @@ -43,7 +43,7 @@ fi # Check that the file is a valid tarball if ! tar -tzf "$TMP_TARBALL" >/dev/null 2>&1; then - echo "Error: Downloaded file is not a valid tarball or is corrupted." + echo "Error: Downloaded file is not a valid tarball or is corrupted." >&2 rm -f "$TMP_TARBALL" exit 1 fi From c7f74d9e8214799ec495f6ebc453d0d88786fbed Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:33:39 -0500 Subject: [PATCH 20/24] Remove download dir --- install.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/install.sh b/install.sh index 67aa3949..21c49263 100755 --- a/install.sh +++ b/install.sh @@ -27,9 +27,6 @@ esac DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz" echo "Downloading from: $DOWNLOAD_URL" -DOWNLOAD_DIR="${HOME}/.copilot" -mkdir -p "$DOWNLOAD_DIR" - # Download and extract with error handling TMP_TARBALL="$(mktemp)" if command -v curl >/dev/null 2>&1; then @@ -48,8 +45,6 @@ if ! tar -tzf "$TMP_TARBALL" >/dev/null 2>&1; then exit 1 fi -tar -xz -C "$DOWNLOAD_DIR" -f "$TMP_TARBALL" -rm -f "$TMP_TARBALL" if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then PREFIX="${PREFIX:-/usr/local}" else @@ -63,17 +58,13 @@ if ! mkdir -p "$INSTALL_DIR"; then fi # Install binary -if [ -f "$DOWNLOAD_DIR/copilot" ]; then - if [ -f "$INSTALL_DIR/copilot" ]; then - echo "Notice: Replacing copilot binary found at $INSTALL_DIR/copilot." - fi - mv -f "$DOWNLOAD_DIR/copilot" "$INSTALL_DIR/copilot" - chmod +x "$INSTALL_DIR/copilot" - echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" -else - echo "Error: copilot binary not found in tarball" >&2 - exit 1 +if [ -f "$INSTALL_DIR/copilot" ]; then + echo "Notice: Replacing copilot binary found at $INSTALL_DIR/copilot." fi +tar -xz -C "$INSTALL_DIR" -f "$TMP_TARBALL" +chmod +x "$INSTALL_DIR/copilot" +echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot" +rm -f "$TMP_TARBALL" # Check if install directory is in PATH case ":$PATH:" in From 1b8ba1d6c92049c6a02edaabc7d2576e91d34977 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:38:17 -0500 Subject: [PATCH 21/24] Document running as root with sudo --- README.md | 2 ++ install.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 3209a274..9a2b7382 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Or wget -qO- https://gh.io/copilot-install | bash ``` +Use `| sudo bash` to run as root and install to `/usr/local/bin`. + Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` when run as root or `$HOME/.local` when run as a non-root user. diff --git a/install.sh b/install.sh index 21c49263..ec1075e8 100755 --- a/install.sh +++ b/install.sh @@ -4,6 +4,7 @@ set -e # GitHub Copilot CLI Installation Script # Usage: curl -fsSL https://gh.io/copilot-install | bash # or: wget -qO- https://gh.io/copilot-install | bash +# Use | sudo bash to run as root and install to /usr/local/bin # Export PREFIX to install to $PREFIX/bin/ directory (default: /usr/local for # root, $HOME/.local for non-root), e.g., export PREFIX=$HOME/custom to install # to $HOME/custom/bin From c068e984906bf2f590df075014b96bd6629939f0 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:48:10 -0500 Subject: [PATCH 22/24] Reorganize --- README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9a2b7382..6bdf404e 100644 --- a/README.md +++ b/README.md @@ -39,29 +39,19 @@ If you have access to GitHub Copilot via your organization or enterprise, you ca ### Installation -#### Any platform with npm - -```bash -npm install -g @github/copilot -``` - -#### Windows - -Install with [WinGet](https://github.com/microsoft/winget-cli): +Install with [WinGet](https://github.com/microsoft/winget-cli) (Windows): ```bash winget install GitHub.Copilot ``` -#### macOS - -Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli): +Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli) (macOS and Linux): ```bash brew install copilot-cli ``` -#### macOS and Linux +Install with the install script (macOS and Linux): ```bash curl -fsSL https://gh.io/copilot-install | bash @@ -73,6 +63,12 @@ Or wget -qO- https://gh.io/copilot-install | bash ``` +Install with [npm](https://www.npmjs.com/package/@github/copilot) (macOS, Linux, and Windows): + +```bash +npm install -g @github/copilot +``` + Use `| sudo bash` to run as root and install to `/usr/local/bin`. Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` From fe9686a0162545db740205695b495d3c95267491 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:54:50 -0500 Subject: [PATCH 23/24] Attempt to use winget --- install.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ec1075e8..0bef6d27 100755 --- a/install.sh +++ b/install.sh @@ -12,10 +12,19 @@ set -e echo "Installing GitHub Copilot CLI..." # Detect platform -case "$(uname -s)" in +case "$(uname -s || echo "")" in Darwin*) PLATFORM="darwin" ;; Linux*) PLATFORM="linux" ;; - *) echo "Error: Unsupported platform $(uname -s). For Windows, we recommend using: winget install GitHub.Copilot" >&2 ; exit 1 ;; + *) + if command -v winget >/dev/null 2>&1; then + echo "Windows detected. Installing via winget..." + winget install GitHub.Copilot + exit $? + else + echo "Error: Windows detected but winget not found. Please see https://gh.io/install-copilot-readme" >&2 + exit 1 + fi + ;; esac # Detect architecture From 791b545a3ece10b36468376977aac8a49ae9f6da Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 13:56:45 -0500 Subject: [PATCH 24/24] Add comment --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 0bef6d27..39f069fa 100755 --- a/install.sh +++ b/install.sh @@ -55,6 +55,7 @@ if ! tar -tzf "$TMP_TARBALL" >/dev/null 2>&1; then exit 1 fi +# Check if running as root, fallback to non-root if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then PREFIX="${PREFIX:-/usr/local}" else