Installing the GitHub CLI on Windows 10 ARM

3 minute read

GitHub started releasing an official build of the GitHub CLI for Windows ARM in version 2.2.0.1. The build is delivered in a zip file and there is no MSI installer provided so far. You can still download the latest release and follow the steps to make the tool available everywhere.

Currently, the GitHub CLI has no supported release for Windows ARM. This guide shows the necessary steps to build and install the GitHub CLI on a computer running Windows 10 ARM like the Surface PRO X.

Install the Go SDK

The GitHub CLI is written in Go so, to be able to build it, we need to install the Go SDK on your machine.

We can fetch the latest version of the Go SDK for Windows ARM from the download page. Here is the direct link to download the installer for the version 1.17 for Windows ARM64.

Normally, you could install Go by using winget install golang.go but this would download the installer for x86/x64 machines so it’s not suitable for our arm64 machine.

Initiate the download of the file and execute it to install the Go SDK on your machine.

Once the installation is complete, you can test whether everything is set up as it should by opening a console and running the command below.

> go version
go version go1.17 windows/amd64

Clone the repository

Once the Go SDK is installed on your machine, we can pull the source code of the CLI from GitHub.

To do so, open a console and navigate to the directory you usually use for cloning Git repositories and clone the cli/cli repository.

> git clone git@github.com:cli/cli.git GitHubCli

Once the repository is cloned, navigate to the directory and switch to the latest release tag.

> cd GitHubCli
> git checkout v2.0.0

Most likely git will notify you that the repository is a detached HEAD state. Ignore this message.

Alternatively, you could clone the repository by its tag.

> git clone --depth 1 --branch v2.0.0 git@github.com:cli/cli.git GitHubCli

This approach is faster because it allows you to minimize the amount of data to download from GitHub.

Build the tool

Initially this repository wasn’t very Windows-friendly but the CLI team deserves the credit for listening the community, fixing all the hurdles and eventually adding a way to build the CLI in Windows as easy as it already was for Linux.

So, while staying in the root of the project repository, simply execute the line below

> go run script\build.go

The build script will take care of downloading all the dependencies and building the source code for the current platform.

Once the build is complete, you’ll find the executable gh.exe in the /bin directory.

You can test it correctly works by running the command

> .\bin\gh.exe --version
gh version 2.0.0 (2021-09-02)
https://github.com/cli/cli/releases/tag/v2.0.0

Make the tool available everywhere

Once the tool is built, it’s conveniente to place it somewhere it can be easily accessed from everywhere.

Normally I place all single-file utilities like this one in a folder called .tools under the user directory.

To achieve this, I copy the executable in the .tools folder.

> cp .\bin\gh.exe $env:USERPROFILE\.tools

Obviously, the script above assumes the folder already exists.

Make sure the destination folder is part of the PATH so that the executables it contains can be used from everywhere.

You can test that the utility can be used from anywhere by opening a new console and executing the following command

> gh --version

Authentication

Before we can use the CLI tool, we need to setup the authentication token so that the CLI can impersonate us when communicating with GitHub.

The authentication flow can be easily initiated by executing

> gh auth login

Additional information regarding the authentication flow can be found here.

Recap

In this post we have seen all the steps needed to build, install and configure the GitHub CLI on a Windows 10 ARM system like a Microsoft Surface PRO X.

Support this blog

If you liked this article, consider supporting this blog by buying me a pizza!