Kategorien
Allgemein

git hub cli MacOs

Why git hub cli ? Uhm. Because I like a command line and can do automation with it.

brew install gh
chrisp:~ sandorm$  gh 
Work seamlessly with GitHub from the command line.

USAGE
  gh <command> <subcommand> [flags]

CORE COMMANDS
  auth:        Authenticate gh and git with GitHub
  browse:      Open the repository in the browser
  codespace:   Connect to and manage codespaces
  gist:        Manage gists
  issue:       Manage issues
  org:         Manage organizations
  pr:          Manage pull requests
  project:     Work with GitHub Projects.
  release:     Manage releases
  repo:        Manage repositories

GITHUB ACTIONS COMMANDS
  cache:       Manage Github Actions caches
  run:         View details about workflow runs
  workflow:    View details about GitHub Actions workflows

ALIAS COMMANDS
  co:          Alias for "pr checkout"
....

We need a token…

gh repo clone containerd/containerd
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.

Create token when signed in into github. Go to https://github.com/settings/tokens

Now working:

chrisp:git sandorm$ gh repo clone containerd/containerd
Cloning into 'containerd'...
remote: Enumerating objects: 128431, done.
remote: Counting objects: 100% (16846/16846), done.
remote: Compressing objects: 100% (1838/1838), done.
remote: Total 128431 (delta 15515), reused 15585 (delta 14963), pack-reused 111585
Receiving objects: 100% (128431/128431), 102.38 MiB | 29.32 MiB/s, done.
Resolving deltas: 100% (82503/82503), done.
Updating files: 100% (5069/5069), done.
chrisp:git sandorm$ date
Sun Jan 14 13:36:02 CET 2024

The token has been exported in GH_TOKEN, in my ~/.bash_profile startup file – respected as ‚login‘.

Instead of UI clicking, you can now do what you learned in your type writer class (you didn’t ?): typing