Install gh-cli (Linux)

PHOTO EMBED

Wed Feb 02 2022 22:08:42 GMT+0000 (Coordinated Universal Time)

Saved by @jimbrig #installation #linux #bash #wsl #github #cli

#!/usr/bin/env bash

# install github-cli
VERSION=`curl  "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
echo $VERSION
mkdir ~/downloads
curl -sSL https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_amd64.tar.gz -o ~/downloads/gh_${VERSION}_linux_amd64.tar.gz
cd ~/downloads
tar xvf gh_${VERSION}_linux_amd64.tar.gz
sudo cp gh_${VERSION}_linux_amd64/bin/gh /usr/local/bin/
gh version
sudo cp -r ~/downloads/gh_${VERSION}_linux_amd64/share/man/man1/* /usr/share/man/man1/
# man gh
gh auth login

rm -r ~/downloads
content_copyCOPY

https://github.com/jimbrig/dotfiles-wsl/blob/main/scripts/dev/scripts/install-gh-cli.sh