Get tag_name from latest
1export RKE_VERSION=$(curl -s https://update.rke2.io/v1-release/channels | jq -r '.data[] | select(.id=="stable") | .latest' | awk -F"+" '{print $1}'| sed 's/v//')
2export CERT_VERSION=$(curl -s https://api.github.com/repos/cert-manager/cert-manager/releases/latest | jq -r .tag_name)
3export RANCHER_VERSION=$(curl -s https://api.github.com/repos/rancher/rancher/releases/latest | jq -r .tag_name)
4export LONGHORN_VERSION=$(curl -s https://api.github.com/repos/longhorn/longhorn/releases/latest | jq -r .tag_name)
5export NEU_VERSION=$(curl -s https://api.github.com/repos/neuvector/neuvector-helm/releases/latest | jq -r .tag_name)
Install gh
1# ubuntu
2type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
3curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
4&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
5&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
6&& sudo apt update \
7&& sudo apt install gh -y
8
9# Redhat
10sudo dnf install 'dnf-command(config-manager)'
11sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
12sudo dnf install gh
Autocompletions
1gh completion zsh > $ZSH/completions/_gh
Create an ssh key ed
Login
1gh auth login -p ssh -h GitHub.com -s read:project,delete:repo,repo,workflow -w
2
3gh auth status
4github.com
5 โ Logged in to github.com as MorzeBaltyk ($HOME/.config/gh/hosts.yml)
6 โ Git operations for github.com configured to use ssh protocol.
7 โ Token: gho_************************************
8 โ Token scopes: delete_repo, gist, read:org, read:project, repo
To use your key
One way:
1eval "$(ssh-agent -s)"
2ssh-add ~/.ssh/id_ed25519
The best way, set in ~/.ssh/config
:
1# Github
2Host github.com
3 HostName github.com
4 User git
5 IdentityFile ~/.ssh/id_ed25519
6 IdentitiesOnly yes
create new project
1gh repo create AnsiColt --private --clone -d "For everytime I want to draw a new ansible collection"
2git config user.name "MorzeBaltyk"
3git config user.email "baltyk@example.com"
Comments