mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
fix: github-cli format
Adds headers propertly and fixes the codeblock format
This commit is contained in:
1 file changed
+110
-100
+110
-100
@@ -1,43 +1,46 @@
|
||||
---
|
||||
title: Github CLI
|
||||
date: 2023-11-29
|
||||
icon:
|
||||
icon:
|
||||
background: bg-[#808080]
|
||||
tags:
|
||||
- Github
|
||||
- CICD
|
||||
- CLI
|
||||
- Github
|
||||
- CICD
|
||||
- CLI
|
||||
categories:
|
||||
- Toolkit
|
||||
intro: A quick reference to Github CLI, an open-source command line tool that enables GitHub on your terminal.
|
||||
- Toolkit
|
||||
intro: A quick reference to Github CLI, an open-source command line tool that enables GitHub on your terminal.
|
||||
plugins:
|
||||
- copyCode
|
||||
- copyCode
|
||||
---
|
||||
|
||||
Getting Started
|
||||
------------
|
||||
## Getting Started
|
||||
|
||||
### Installation
|
||||
|
||||
**Windows**
|
||||
|
||||
| | Install | Upgrade |
|
||||
| :--- | :--- | :--- |
|
||||
| | Install | Upgrade |
|
||||
| WinGet | ```winget install --id Github.cli``` | ```winget upgrade --id GitHub.cli``` |
|
||||
| Scoop | ```scoop install gh``` | ```scoop update gh``` |
|
||||
| Choco | ```choco install gh``` | ```choco upgrade gh``` |
|
||||
| Tool | Install | Upgrade |
|
||||
| :----- | :------------------------------- | :------------------------------- |
|
||||
| WinGet | `winget install --id Github.cli` | `winget upgrade --id GitHub.cli` |
|
||||
| Scoop | `scoop install gh` | `scoop update gh` |
|
||||
| Choco | `choco install gh` | `choco upgrade gh` |
|
||||
|
||||
{.show-header}
|
||||
|
||||
**Mac OS**
|
||||
| | Install | Upgrade |
|
||||
| :--- | :--- | :--- |
|
||||
| | Install | Upgrade |
|
||||
| Brew | ```brew install gh ``` | ```brew upgrade gh``` |
|
||||
| MacPorts | ```sudo port install gh``` | ```sudo port selfupdate && sudo port upgrade gh``` |
|
||||
|
||||
| Tool | Install | Upgrade |
|
||||
| :------- | :--------------------- | :--------------------------------------------- |
|
||||
| Brew | `brew install gh` | `brew upgrade gh` |
|
||||
| MacPorts | `sudo port install gh` | `sudo port selfupdate && sudo port upgrade gh` |
|
||||
|
||||
{.show-header}
|
||||
|
||||
**Linux**
|
||||
|
||||
See the [install instructions](https://github.com/cli/cli/blob/trunk/docs/install_linux.md) for other Linux distributions.
|
||||
See the [install instructions](https://github.com/cli/cli/blob/trunk/docs/install_linux.md) for other Linux
|
||||
distributions.
|
||||
|
||||
Installation Script:
|
||||
|
||||
@@ -49,6 +52,7 @@ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo
|
||||
&& sudo apt update \
|
||||
&& sudo apt install gh -y
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Basic Usage
|
||||
@@ -57,22 +61,23 @@ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo
|
||||
|
||||
Display command options:
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh help [command]``` | Help provides help for any command in the application. Simply type gh help [path to command] for full details. |
|
||||
| Command | Description |
|
||||
| :------------------ | :------------------------------------------------------------------------------------------------------------- |
|
||||
| `gh help [command]` | Help provides help for any command in the application. Simply type gh help [path to command] for full details. |
|
||||
|
||||
**Authentication**
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh auth login``` | Default authentication with web-based browser |
|
||||
| ```gh auth logout``` | Removes the authentication configuration for a host |
|
||||
| ```gh auth refresh``` | Expand or fix the permission scopes for stored credentials |
|
||||
| ```gh auth setup-git``` | Configures git to use GitHub CLI as a credential helper |
|
||||
| ```gh auth status``` | Verifies and displays information about your authentication state |
|
||||
| ```gh auth token``` | Print the auth token gh is configured to use |
|
||||
| Command | Description |
|
||||
| :------------------ | :---------------------------------------------------------------- |
|
||||
| `gh auth login` | Default authentication with web-based browser |
|
||||
| `gh auth logout` | Removes the authentication configuration for a host |
|
||||
| `gh auth refresh` | Expand or fix the permission scopes for stored credentials |
|
||||
| `gh auth setup-git` | Configures git to use GitHub CLI as a credential helper |
|
||||
| `gh auth status` | Verifies and displays information about your authentication state |
|
||||
| `gh auth token` | Print the auth token gh is configured to use |
|
||||
|
||||
With Github token:
|
||||
|
||||
```shell
|
||||
$ gh auth --with-token < token.txt
|
||||
```
|
||||
@@ -80,34 +85,37 @@ $ gh auth --with-token < token.txt
|
||||
### Repository Management
|
||||
|
||||
**General**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh repo create``` | Create a new GitHub repository |
|
||||
| ```gh repo list [target]``` | List repositories owned by a user or organization |
|
||||
|
||||
| Command | Description |
|
||||
| :---------------------- | :------------------------------------------------ |
|
||||
| `gh repo create` | Create a new GitHub repository |
|
||||
| `gh repo list [target]` | List repositories owned by a user or organization |
|
||||
|
||||
**Targets**
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh repo archive [repo]``` | Archive a GitHub repository |
|
||||
| ```gh repo clone [dir]``` | Clone a GitHub repository locally |
|
||||
| ```gh repo delete [repo]``` | Delete a GitHub repository |
|
||||
| ```gh repo deploy-key``` | Manage deploy keys in a repository |
|
||||
| ```gh repo edit [repo]``` | Edit repository settings |
|
||||
| ```gh repo fork [repo]``` | Create a fork of a repository |
|
||||
| ```gh repo rename [name]``` | Rename a GitHub repository |
|
||||
| ```gh repo set-default [repo]``` | This command sets the default remote repository |
|
||||
| ```gh repo sync [dest-repo]``` | Sync destination repository from source repository |
|
||||
| ```gh repo view [repo]``` | Display the description and the README of a GitHub repository. |
|
||||
| Command | Description |
|
||||
| :--------------------------- | :------------------------------------------------------------- |
|
||||
| `gh repo archive [repo]` | Archive a GitHub repository |
|
||||
| `gh repo clone [dir]` | Clone a GitHub repository locally |
|
||||
| `gh repo delete [repo]` | Delete a GitHub repository |
|
||||
| `gh repo deploy-key` | Manage deploy keys in a repository |
|
||||
| `gh repo edit [repo]` | Edit repository settings |
|
||||
| `gh repo fork [repo]` | Create a fork of a repository |
|
||||
| `gh repo rename [name]` | Rename a GitHub repository |
|
||||
| `gh repo set-default [repo]` | This command sets the default remote repository |
|
||||
| `gh repo sync [dest-repo]` | Sync destination repository from source repository |
|
||||
| `gh repo view [repo]` | Display the description and the README of a GitHub repository. |
|
||||
|
||||
### Issues
|
||||
|
||||
**Search Issues**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh search issues [query]``` | Search for issues on GitHub |
|
||||
|
||||
| Command | Description |
|
||||
| :------------------------- | :-------------------------- |
|
||||
| `gh search issues [query]` | Search for issues on GitHub |
|
||||
|
||||
**Examples**
|
||||
|
||||
```bash
|
||||
# search issues matching set of keywords "readme" and "typo"
|
||||
$ gh search issues readme typo
|
||||
@@ -132,11 +140,11 @@ $ gh search issues -- -label:bug
|
||||
|
||||
**Pull Request Actions**
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh pr create``` | Create a pull request on GitHub |
|
||||
| ```gh pr list``` | List pull requests in a GitHub repository |
|
||||
| ```gh pr status``` | Show status of relevant pull requests |
|
||||
| Command | Description |
|
||||
| :------------- | :---------------------------------------- |
|
||||
| `gh pr create` | Create a pull request on GitHub |
|
||||
| `gh pr list` | List pull requests in a GitHub repository |
|
||||
| `gh pr status` | Show status of relevant pull requests |
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -145,6 +153,7 @@ $ gh pr status
|
||||
```
|
||||
|
||||
Sample Output:
|
||||
|
||||
```
|
||||
Current branch
|
||||
#12 Remove the test feature [user:patch-2]
|
||||
@@ -160,67 +169,68 @@ Requesting a code review from you
|
||||
- Checks passing - Approved
|
||||
```
|
||||
|
||||
### Github Actions
|
||||
### Github Actions
|
||||
|
||||
**General Actions**
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh workflow disable``` | Disable a workflow, preventing it from running or showing up when listing workflows |
|
||||
| ```gh workflow enable``` | Enable a workflow, allowing it to be run and show up when listing workflows |
|
||||
| ```gh workflow list``` | List workflow files, hiding disabled workflows by default |
|
||||
| ```gh workflow run``` | Create a workflow_dispatch event for a given workflow |
|
||||
| ```gh workflow view``` | View the summary of a workflow |
|
||||
| Command | Description |
|
||||
| :-------------------- | :---------------------------------------------------------------------------------- |
|
||||
| `gh workflow disable` | Disable a workflow, preventing it from running or showing up when listing workflows |
|
||||
| `gh workflow enable` | Enable a workflow, allowing it to be run and show up when listing workflows |
|
||||
| `gh workflow list` | List workflow files, hiding disabled workflows by default |
|
||||
| `gh workflow run` | Create a workflow_dispatch event for a given workflow |
|
||||
| `gh workflow view` | View the summary of a workflow |
|
||||
|
||||
**Running Actions**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh run cancel``` | Cancel a workflow run |
|
||||
| ```gh run delete``` | Delete a workflow run |
|
||||
| ```gh run download``` | Download artifacts generated by a GitHub Actions workflow run |
|
||||
| ```gh run list``` | List recent workflow runs |
|
||||
| ```gh run rerun``` | Rerun an entire run, only failed jobs, or a specific job from a run |
|
||||
| ```gh run view``` | View a summary of a workflow run |
|
||||
| ```gh run watch``` | Watch a run until it completes, showing its progress |
|
||||
|
||||
### Aliases
|
||||
| Command | Description |
|
||||
| :---------------- | :------------------------------------------------------------------ |
|
||||
| `gh run cancel` | Cancel a workflow run |
|
||||
| `gh run delete` | Delete a workflow run |
|
||||
| `gh run download` | Download artifacts generated by a GitHub Actions workflow run |
|
||||
| `gh run list` | List recent workflow runs |
|
||||
| `gh run rerun` | Rerun an entire run, only failed jobs, or a specific job from a run |
|
||||
| `gh run view` | View a summary of a workflow run |
|
||||
| `gh run watch` | Watch a run until it completes, showing its progress |
|
||||
|
||||
### Aliases
|
||||
|
||||
**General Alias Settings**
|
||||
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh alias delete``` | Delete set aliases |
|
||||
| ```gh alias import``` | Import aliases from the contents of a YAML file |
|
||||
| ```gh alias list``` | Prints out all of the aliases gh is configured to use |
|
||||
| ```gh alias set``` | Define a word that will expand to a full gh command when invoked |
|
||||
|
||||
| Command | Description |
|
||||
| :---------------- | :--------------------------------------------------------------- |
|
||||
| `gh alias delete` | Delete set aliases |
|
||||
| `gh alias import` | Import aliases from the contents of a YAML file |
|
||||
| `gh alias list` | Prints out all of the aliases gh is configured to use |
|
||||
| `gh alias set` | Define a word that will expand to a full gh command when invoked |
|
||||
|
||||
### Releases
|
||||
|
||||
**General Actions**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh release create``` | Create a new GitHub Release for a repository |
|
||||
| ```gh release list``` | List releases in a repository |
|
||||
|
||||
| Command | Description |
|
||||
| :------------------ | :------------------------------------------- |
|
||||
| `gh release create` | Create a new GitHub Release for a repository |
|
||||
| `gh release list` | List releases in a repository |
|
||||
|
||||
**Target Commands**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
|```gh release delete``` | Delete a release |
|
||||
|```gh release delete-asset``` | Delete an asset from a release |
|
||||
|```gh release download``` | Download assets from a GitHub release |
|
||||
|```gh release edit``` | Edit a release |
|
||||
|```gh release upload``` | Upload asset files to a GitHub Release |
|
||||
|```gh release view``` | View information about a GitHub Release |
|
||||
|
||||
| Command | Description |
|
||||
| :------------------------ | :-------------------------------------- |
|
||||
| `gh release delete` | Delete a release |
|
||||
| `gh release delete-asset` | Delete an asset from a release |
|
||||
| `gh release download` | Download assets from a GitHub release |
|
||||
| `gh release edit` | Edit a release |
|
||||
| `gh release upload` | Upload asset files to a GitHub Release |
|
||||
| `gh release view` | View information about a GitHub Release |
|
||||
|
||||
### Configuration
|
||||
|
||||
**Targeted Settings**
|
||||
| Command | Description |
|
||||
| :--- | :--- |
|
||||
| ```gh config clear-cache``` | Clear the cli cache |
|
||||
| ```gh config get``` | Print the value of a given configuration key |
|
||||
| ```gh config list``` | Print a list of configuration keys and values |
|
||||
| ```gh config set``` | Update configuration with a value for the given key |
|
||||
|
||||
|
||||
| Command | Description |
|
||||
| :---------------------- | :-------------------------------------------------- |
|
||||
| `gh config clear-cache` | Clear the cli cache |
|
||||
| `gh config get` | Print the value of a given configuration key |
|
||||
| `gh config list` | Print a list of configuration keys and values |
|
||||
| `gh config set` | Update configuration with a value for the given key |
|
||||
Reference in new issue
Block a user