### Install All Skills from Repository Source: https://cli.github.com/manual/gh_skill_install Installs all available skills from the specified GitHub repository. Use this for a complete installation. ```bash gh skill install github/awesome-copilot --all ``` -------------------------------- ### View workflow examples Source: https://cli.github.com/manual/gh_workflow_view Examples showing how to interactively select a workflow or view a specific one by ID. ```bash # Interactively select a workflow to view $ gh workflow view # View a specific workflow $ gh workflow view 0451 ``` -------------------------------- ### Install All Skills from Local Directory Source: https://cli.github.com/manual/gh_skill_install Installs all skills found within a local directory. Use the --from-local flag for local installations. ```bash gh skill install ./my-skills-repo --from-local ``` -------------------------------- ### Interactive Skill Installation Source: https://cli.github.com/manual/gh_skill_install Initiates an interactive session to choose the repository, skill, and agent for installation. ```bash $ gh skill install ``` -------------------------------- ### Add item to project example Source: https://cli.github.com/manual/gh_project_item-add Example command to add a specific issue URL to a project owned by a user. ```bash # Add an item to monalisa's project "1" $ gh project item-add 1 --owner monalisa --url https://github.com/monalisa/myproject/issues/23 ``` -------------------------------- ### Start Interactive gh Auth Login Source: https://cli.github.com/manual/gh_auth_login Initiates an interactive setup process for authenticating with GitHub. This is the default behavior when no flags are provided. ```bash gh auth login ``` -------------------------------- ### List repository rulesets Source: https://cli.github.com/manual/gh_ruleset Use this command to list all available rulesets for a repository. No setup is required beyond having the gh CLI installed. ```bash gh ruleset list ``` -------------------------------- ### Create a release and start a discussion Source: https://cli.github.com/manual/gh_release_create Create a new release and simultaneously start a discussion thread for it in a specified category. ```bash # Create a release and start a discussion $ gh release create v1.2.3 --discussion-category "General" ``` -------------------------------- ### Setup Git with GitHub CLI Source: https://cli.github.com/manual/gh_help_reference Use this command to set up git with the GitHub CLI. Supports forcing setup for unknown hosts and specifying the hostname. ```bash gh auth setup-git [flags] ``` -------------------------------- ### Rename repository examples Source: https://cli.github.com/manual/gh_repo_rename Examples showing how to rename the current repository or a specific remote repository. ```bash # Rename the current repository (foo/bar -> foo/baz) $ gh repo rename baz # Rename the specified repository (qux/quux -> qux/baz) $ gh repo rename -R qux/quux baz ``` -------------------------------- ### Install a Skill Source: https://cli.github.com/manual/gh_skill Install an agent skill from a specified GitHub repository and skill name. Ensure the repository and skill name are correct. ```bash # Install a skill $ gh skill install github/awesome-copilot documentation-writer ``` -------------------------------- ### List GitHub Issues Source: https://cli.github.com/manual/gh_issue Use this command to list all issues in the current repository. No specific setup is required beyond having the GitHub CLI installed and authenticated. ```bash $ gh issue list ``` -------------------------------- ### Install Skill from Large Namespaced Repository Source: https://cli.github.com/manual/gh_skill_install Installs a skill from a large, namespaced repository by specifying the path. This method is efficient as it skips full repository discovery. ```bash gh skill install github/awesome-copilot skills/monalisa/code-review ``` -------------------------------- ### Install Specific Skill Source: https://cli.github.com/manual/gh_skill_install Installs a particular skill (e.g., 'git-commit') from a specified GitHub repository. ```bash $ gh skill install github/awesome-copilot git-commit ``` -------------------------------- ### Install Specific Skill Version Source: https://cli.github.com/manual/gh_skill_install Installs a particular version of a skill from a GitHub repository. Useful for managing skill versions. ```bash gh skill install github/awesome-copilot git-commit@v1.2.0 ``` -------------------------------- ### Install GitHub CLI Extension from Local Repository Source: https://cli.github.com/manual/gh_extension_install Install an extension from a local repository, typically used during development. Use `.` to specify the current working directory. ```bash gh extension install . ``` -------------------------------- ### View the Go .gitignore Template Source: https://cli.github.com/manual/gh_repo_gitignore_view This example shows how to view the content of the Go .gitignore template. The output will be printed to the console. ```bash # View the Go gitignore template $ gh repo gitignore view Go ``` -------------------------------- ### List fields in a user project Source: https://cli.github.com/manual/gh_project_field-list Example command to list fields for a specific project owned by the current user. ```bash # List fields in the current user's project "1" $ gh project field-list 1 --owner "@me" ``` -------------------------------- ### Install Specific Local Skill Source: https://cli.github.com/manual/gh_skill_install Installs a specific skill by name from a local directory. Requires the --from-local flag. ```bash gh skill install ./my-skills-repo git-commit --from-local ``` -------------------------------- ### Add parameters to a GET request Source: https://cli.github.com/manual/gh_api Example of performing a GET request to search issues, adding query parameters using the '-f' flag and explicitly setting the method with '-X GET'. ```bash # Add parameters to a GET request $ gh api -X GET search/issues -f q='repo:cli/cli is:open remote' ``` -------------------------------- ### gh extension install [flags] Source: https://cli.github.com/manual/gh_help_reference Install a gh extension from a repository. Supports forcing an upgrade or pinning to a specific release. ```APIDOC ## `gh extension install [flags]` ### Description Install a gh extension from a repository. ### Flags - `--force` - Force upgrade extension, or ignore if latest already installed - `--pin string` - Pin extension to a release tag or commit ref ``` -------------------------------- ### Open User's Project in Browser Source: https://cli.github.com/manual/gh_project_view This example demonstrates opening project number '1' owned by user 'monalisa' directly in the web browser. ```bash # Open user monalisa's project "1" in the browser $ gh project view 1 --owner monalisa --web ``` -------------------------------- ### List Installed Skills Source: https://cli.github.com/manual/gh_skill View a list of all agent skills currently installed on your system. ```bash # List installed skills $ gh skill list ``` -------------------------------- ### Install GitHub CLI Extension from Owner/Repo Source: https://cli.github.com/manual/gh_extension_install Use this command to install an extension from a remote repository hosted on GitHub. The repository is specified in the `OWNER/REPO` format. ```bash gh extension install owner/gh-extension ``` -------------------------------- ### Generate and add a deploy key Source: https://cli.github.com/manual/gh_repo_deploy-key_add Example showing the generation of an SSH key followed by adding it to a repository using the GitHub CLI. ```bash # Generate a passwordless SSH key and add it as a deploy key to a repository $ ssh-keygen -t ed25519 -C "my description" -N "" -f ~/.ssh/gh-test $ gh repo deploy-key add ~/.ssh/gh-test.pub ``` -------------------------------- ### Install GitHub CLI Extension from URL Source: https://cli.github.com/manual/gh_extension_install Install an extension from a remote repository using its full URL. This is useful for repositories not hosted on `github.com`. ```bash gh extension install https://my.ghes.com/owner/gh-extension ``` -------------------------------- ### Delete Item Example Source: https://cli.github.com/manual/gh_project_item-delete Example of how to delete an item from a project owned by the current user. Ensure you replace `` with the actual ID of the item to be deleted. ```bash # Delete an item in the current user's project "1" $ gh project item-delete 1 --owner "@me" --id ``` -------------------------------- ### gh repo sync examples Source: https://cli.github.com/manual/gh_repo_sync Common usage patterns for synchronizing local and remote repositories. ```bash # Sync local repository from remote parent $ gh repo sync # Sync local repository from remote parent on specific branch $ gh repo sync --branch v1 # Sync remote fork from its parent $ gh repo sync owner/cli-fork # Sync remote repository from another remote repository $ gh repo sync owner/repo --source owner2/repo2 ``` -------------------------------- ### View the Python .gitignore Template Source: https://cli.github.com/manual/gh_repo_gitignore_view This example demonstrates viewing the Python .gitignore template. The content will be displayed in your terminal. ```bash # View the Python gitignore template $ gh repo gitignore view Python ``` -------------------------------- ### Install Skill from Non-Standard Nested Path Source: https://cli.github.com/manual/gh_skill_install Installs a skill from a non-standard, nested path within a repository. This is an efficient method that bypasses full discovery. ```bash gh skill install monalisa/skills-repo packages/agent-skills/code-review ``` -------------------------------- ### Workflow run examples Source: https://cli.github.com/manual/gh_workflow_run Common usage patterns for triggering workflows, including interactive prompts, specific files, refs, and input handling. ```bash # Have gh prompt you for what workflow you'd like to run and interactively collect inputs $ gh workflow run # Run the workflow file 'triage.yml' at the remote's default branch $ gh workflow run triage.yml # Run the workflow file 'triage.yml' at a specified ref $ gh workflow run triage.yml --ref my-branch # Run the workflow file 'triage.yml' with command line inputs $ gh workflow run triage.yml -f name=scully -f greeting=hello # Run the workflow file 'triage.yml' with JSON via standard input $ echo '{"name":"scully", "greeting":"hello"}' | gh workflow run triage.yml --json ``` -------------------------------- ### Interactively Choose a Ruleset to View Source: https://cli.github.com/manual/gh_ruleset_view This example shows how to interactively select a ruleset to view from all rulesets that apply to the current repository. No specific ruleset ID or flags are provided, triggering the interactive prompt. ```bash # Interactively choose a ruleset to view from all rulesets that apply to the current repository $ gh ruleset view ``` -------------------------------- ### List installed gh extensions Source: https://cli.github.com/manual/gh_extension_search To list only the extensions that are already installed locally, use the `gh ext list` command. ```bash gh ext list ``` -------------------------------- ### Preview a Skill Source: https://cli.github.com/manual/gh_skill Preview an agent skill from a GitHub repository and skill name before installing it. This helps in evaluating the skill's content. ```bash # Preview a skill before installing $ gh skill preview github/awesome-copilot documentation-writer ``` -------------------------------- ### View Current User's Project Source: https://cli.github.com/manual/gh_project_view This example shows how to view project number '1' belonging to the currently authenticated user. ```bash # View the current user's project "1" $ gh project view 1 ``` -------------------------------- ### List all installed skills Source: https://cli.github.com/manual/gh_skill_list Use this command to list all agent skills that are currently installed. It scans both project and user scopes by default. ```bash gh skill list ``` -------------------------------- ### List releases in the current repository Source: https://cli.github.com/manual/gh_api Example of listing releases for the current repository using the gh api command. ```bash # List releases in the current repository $ gh api repos/{owner}/{repo}/releases ``` -------------------------------- ### View a Specific Ruleset by ID Source: https://cli.github.com/manual/gh_ruleset_view This example demonstrates viewing a specific ruleset identified by the ID `43`. It includes rulesets configured in the current repository or any of its parent levels, as the `--parents` flag is enabled by default. ```bash # View a ruleset configured in the current repository or any of its parents $ gh ruleset view 43 ``` -------------------------------- ### Create a release using notes from a file Source: https://cli.github.com/manual/gh_release_create Specify a file to read the release notes from. Use '-' to read from standard input. ```bash # Use release notes from a file $ gh release create v1.2.3 -F release-notes.md ``` -------------------------------- ### Run gh copilot CLI Source: https://cli.github.com/manual/gh_copilot Execute the GitHub Copilot CLI. If not installed, it will be downloaded. Use `--` to pass flags to the Copilot CLI. ```bash gh copilot [flags] [args] ``` ```bash # Download and run the Copilot CLI $ gh copilot ``` ```bash # Run the Copilot CLI $ gh copilot -p "Summarize this week's commits" --allow-tool 'shell(git)' ``` ```bash # Run the Copilot CLI help command $ gh copilot -- --help ``` -------------------------------- ### Viewing issues relevant to you Source: https://cli.github.com/manual/gh_issue_status This example demonstrates how to view issues assigned to you, mentioning you, or opened by you without any special flags. The output is human-readable by default. ```bash # Viewing issues relevant to you ~/Projects/my-project$ gh issue status **Issues assigned to you** #8509 [Fork] Improve how Desktop handles forks (epic:fork, meta) **Issues mentioning you** #8938 [Fork] Add create fork flow entry point at commit warning (epic:fork) #8509 [Fork] Improve how Desktop handles forks (epic:fork, meta) **Issues opened by you** #8936 [Fork] Hide PR number badges on branches that have an upstream PR (epic:fork) #6386 Improve no editor detected state on conflicts modal (enhancement) ~/Projects/my-project$ ``` -------------------------------- ### GitHub CLI Skill Install Flags Source: https://cli.github.com/manual/gh_help_reference Flags for installing agent skills using the 'gh skill install' command. Skills can be installed from a repository or local directory, with options to force overwrite, pin to a version, and specify the installation scope or target agent. ```bash --agent string Target agent (see supported values above) --all Install all skills without prompting for skill selection --allow-hidden-dirs Include skills in hidden directories (e.g. .claude/skills/, .agents/skills/) --dir string Install to a custom directory (overrides --agent and --scope) -f, --force Overwrite existing skills without prompting --from-local Treat the argument as a local directory path instead of a repository --pin string Pin to a specific git tag or commit SHA --scope string Installation scope: {project|user} (default "project") --upstream Install from the upstream source when a re-published skill is detected ``` -------------------------------- ### Create a draft issue in a project Source: https://cli.github.com/manual/gh_project_item-create Example of creating a draft issue in the current user's project. ```bash # Create a draft issue in the current user's project "1" $ gh project item-create 1 --owner "@me" --title "new item" --body "new item body" ``` -------------------------------- ### Create a project Source: https://cli.github.com/manual/gh_help_reference Use this command to create a project. Options include specifying output format, filtering with jq, specifying the owner, and setting the title. ```bash gh project create [flags] --format string Output format: {json} -q, --jq expression Filter JSON output using a jq expression --owner string Login of the owner. Use "@me" for the current user. -t, --template string Format JSON output using a Go template; see "gh help formatting" --title string Title for the project ``` -------------------------------- ### List GitHub Actions Caches Source: https://cli.github.com/manual/gh_cache Use this command to view a list of available caches for the repository. No setup is required. ```bash gh cache list ``` -------------------------------- ### Install Skill for Specific Agent and Scope Source: https://cli.github.com/manual/gh_skill_install Installs a skill for a particular agent (e.g., Claude Code) and sets the installation scope to 'user'. ```bash gh skill install github/awesome-copilot git-commit --agent claude-code --scope user ``` -------------------------------- ### Link Project to Repository Source: https://cli.github.com/manual/gh_project_link Example of linking a project to a specific repository. The --owner and --repo flags are used to specify the target. ```bash # Link monalisa's project 1 to her repository "my_repo" $ gh project link 1 --owner monalisa --repo my_repo ``` -------------------------------- ### gh extension install flags Source: https://cli.github.com/manual/gh_help_reference Flags for installing or upgrading gh extensions. ```bash --force Force upgrade extension, or ignore if latest already installed --pin string Pin extension to a release tag or commit ref ``` -------------------------------- ### gh skill install Command Usage Source: https://cli.github.com/manual/gh_skill_install Basic usage of the 'gh skill install' command. This command installs agent skills from a specified GitHub repository or local directory into the local environment. ```bash gh skill install [] [flags] ``` -------------------------------- ### Set Configuration Value Source: https://cli.github.com/manual/gh_config_set Use this command to set a configuration key to a specific value. For example, setting the default editor. ```bash gh config set editor vim ``` ```bash gh config set editor "code --wait" ``` ```bash gh config set prompt disabled ``` -------------------------------- ### Update All Installed Skills Source: https://cli.github.com/manual/gh_skill Update all agent skills that are currently installed to their latest versions. ```bash # Update all installed skills $ gh skill update --all ``` -------------------------------- ### Cloning a repository using OWNER/REPO syntax Source: https://cli.github.com/manual/gh_repo_clone Demonstrates cloning a repository using the standard OWNER/REPO syntax. The output shows the cloning process and the user changing into the new directory. ```bash # Cloning a repository ~/Projects$ gh repo clone cli/cli Cloning into 'cli'... ~/Projects$ cd cli ~/Projects/cli$ ``` -------------------------------- ### Get Help for a GitHub CLI Command Source: https://cli.github.com/manual/gh_help Use this command to access detailed documentation for any gh subcommand. Provide the path to the command for specific help. ```bash gh help [command] ``` -------------------------------- ### Create a repository interactively Source: https://cli.github.com/manual/gh_repo_create Run this command with no arguments to create a repository interactively, where you will be prompted for details. ```bash gh repo create ``` -------------------------------- ### Use a pull request template Source: https://cli.github.com/manual/gh_pr_create Use the `--template` flag to specify a file that will be used as the starting content for the pull request body. ```bash $ gh pr create --template "pull_request_template.md" ``` -------------------------------- ### List skills as JSON with specified fields Source: https://cli.github.com/manual/gh_skill_list Obtain a JSON output of installed skills, including only the fields you specify. This is helpful for programmatic processing of skill information. ```bash gh skill list --json skillName,sourceURL,scope,version,pinned,path ``` -------------------------------- ### View Project Source: https://cli.github.com/manual/gh_help_reference Displays a project with options for formatting, filtering, and opening in a browser. ```bash gh project view [] [flags] --format string Output format: {json} -q, --jq expression Filter JSON output using a jq expression --owner string Login of the owner. Use "@me" for the current user. -t, --template string Format JSON output using a Go template; see "gh help formatting" -w, --web Open a project in the browser ``` -------------------------------- ### Link Project to Repository of Current Directory Source: https://cli.github.com/manual/gh_project_link Example of linking a project when neither --repo nor --team is specified, defaulting to the repository of the current directory. ```bash # Link monalisa's project 1 to the repository of current directory if neither --repo nor --team is specified $ gh project link 1 ``` -------------------------------- ### Use a JSON file as request body Source: https://cli.github.com/manual/gh_api Example of making a request to create repository rulesets, using a JSON file as the request body via the '--input' flag. ```bash # Use a JSON file as request body $ gh api repos/{owner}/{repo}/rulesets --input file.json ``` -------------------------------- ### Create a Precompiled Go GitHub CLI Extension Source: https://cli.github.com/manual/gh_extension_create Create a new extension named 'foobar' that is precompiled using Go. Ensure your Go environment is set up correctly. ```bash gh extension create --precompiled=go foobar ``` -------------------------------- ### Install Skills from Hidden Directories Source: https://cli.github.com/manual/gh_skill_install Installs skills even if they are located in hidden directories (e.g., .claude/skills/). Use the --allow-hidden-dirs flag. ```bash gh skill install owner/repo --allow-hidden-dirs ``` -------------------------------- ### Browse and preview interactively Source: https://cli.github.com/manual/gh_skill_preview Initiate an interactive session to browse and preview skills within a repository. ```bash # Browse and preview interactively $ gh skill preview github/awesome-copilot ``` -------------------------------- ### Create a new remote repository and clone it locally Source: https://cli.github.com/manual/gh_repo_create Create a public repository named 'my-project' and clone it to your local machine. The `--clone` flag ensures the repository is cloned after creation. ```bash gh repo create my-project --public --clone ``` -------------------------------- ### List project fields command syntax Source: https://cli.github.com/manual/gh_project_field-list Basic command structure for listing fields in a project. ```bash gh project field-list [] [flags] ``` -------------------------------- ### Create Agent Task and Follow Logs Source: https://cli.github.com/manual/gh_agent-task_create To create a task and monitor its execution in real-time, use the `--follow` flag. This is useful for observing the progress and output of the agent task as it runs. ```bash gh agent-task create "build me a new app" --follow ``` -------------------------------- ### List Installed GitHub CLI Extensions Source: https://cli.github.com/manual/gh_extension_list Use this command to display a list of all extensions currently installed in your GitHub CLI. This includes their names and available commands. ```bash gh extension list ``` -------------------------------- ### Install SSH Server in Devcontainer Source: https://cli.github.com/manual/gh_codespace_ssh Add this feature to your `devcontainer.json` to install an SSH server in your codespace, which is required for SSH connections. This is particularly useful for Debian-based images. ```json { "features": { "ghcr.io/devcontainers/features/sshd:1": { "version": "latest" } } } ``` -------------------------------- ### Non-interactively create a release with notes Source: https://cli.github.com/manual/gh_release_create Create a release with a specified tag and provide release notes directly via the command line. ```bash # Non-interactively create a release $ gh release create v1.2.3 --notes "bugfix release" ``` -------------------------------- ### Create a release using tag annotation as notes Source: https://cli.github.com/manual/gh_release_create Use the annotation or commit message of a git tag as the release notes. ```bash # Use tag annotation or associated commit message as notes $ gh release create v1.2.3 --notes-from-tag ``` -------------------------------- ### Example YAML alias definition Source: https://cli.github.com/manual/gh_alias_import This is an example of the YAML format for defining aliases. Keys are alias names, and values are the commands they expand to. Multi-line commands are supported. ```yaml bugs: issue list --label=bug igrep: '!gh issue list --label="$1" | grep "$2"' features: |- issue list --label=enhancement ``` -------------------------------- ### Fix Install Metadata Without Publishing Source: https://cli.github.com/manual/gh_skill_publish Automatically strip install metadata from committed files without publishing the skills. Review and commit the changes before running publish again. ```bash gh skill publish --fix ``` -------------------------------- ### Upgrade GitHub CLI Extensions Source: https://cli.github.com/manual/gh_extension_upgrade Use this command to upgrade installed extensions. You can upgrade a specific extension by providing its name or upgrade all installed extensions using the `--all` flag. ```bash gh extension upgrade { | --all} [flags] ``` -------------------------------- ### Upgrade GitHub CLI Extensions Source: https://cli.github.com/manual/gh_extension_upgrade Command to upgrade installed GitHub CLI extensions. You can upgrade a specific extension by providing its name or upgrade all installed extensions using the --all flag. ```APIDOC ## gh extension upgrade ### Description Upgrade installed extensions. ### Usage ``` gh extension upgrade { | --all} [flags] ``` ### Options * `--all` (boolean) - Upgrade all extensions * `--dry-run` (boolean) - Only display upgrades * `--force` (boolean) - Force upgrade extension ### See also * gh extension ``` -------------------------------- ### GET /ruleset/list Source: https://cli.github.com/manual/gh_ruleset_list Lists GitHub rulesets for a repository or organization. ```APIDOC ## GET gh ruleset list ### Description List GitHub rulesets for a repository or organization. If no options are provided, the current repository's rulesets are listed. ### Method GET ### Endpoint gh ruleset list ### Parameters #### Query Parameters - **--limit** (int) - Optional - Maximum number of rulesets to list (default 30). - **--org** (string) - Optional - List organization-wide rulesets for the provided organization. Requires admin:org scope. - **--parents** (boolean) - Optional - Whether to include rulesets configured at higher levels (default true). - **--web** (flag) - Optional - Open the list of rulesets in the web browser. - **--repo** (string) - Optional - Select another repository using the [HOST/]OWNER/REPO format. ### Request Example $ gh ruleset list --repo owner/repo --parents ### Response Returns a list of rulesets configured for the specified repository or organization. ``` -------------------------------- ### Switch GitHub Account via Prompt Source: https://cli.github.com/manual/gh_auth_switch Use this command to interactively select the GitHub host and account to switch to. This is useful when you have multiple accounts configured for different hosts or the same host. ```bash gh auth switch ``` -------------------------------- ### View Repository in Browser Source: https://cli.github.com/manual/examples Opens a specific repository in your default web browser. Use the `--web` or `-w` flag. ```bash # Viewing a repository in the browser ~/Projects$ gh repo view owner/repo --web Opening https://github.com/owner/repo/ in your browser. ~/Projects$ ``` -------------------------------- ### GET /variable/list Source: https://cli.github.com/manual/gh_variable_list Lists variables available in a repository, environment, or organization. ```APIDOC ## GET gh variable list ### Description List variables on the repository, environment, or organization level. ### Method GET ### Endpoint gh variable list ### Parameters #### Query Parameters - **-e, --env** (string) - Optional - List variables for an environment - **-o, --org** (string) - Optional - List variables for an organization - **-R, --repo** (string) - Optional - Select another repository using the [HOST/]OWNER/REPO format - **-q, --jq** (string) - Optional - Filter JSON output using a jq expression - **--json** (fields) - Optional - Output JSON with the specified fields - **-t, --template** (string) - Optional - Format JSON output using a Go template ### Response #### Success Response (200) - **createdAt** (string) - Creation timestamp - **name** (string) - Variable name - **numSelectedRepos** (integer) - Number of selected repositories - **selectedReposURL** (string) - URL for selected repositories - **updatedAt** (string) - Last update timestamp - **value** (string) - Variable value - **visibility** (string) - Variable visibility level ``` -------------------------------- ### Get a Variable Source: https://cli.github.com/manual/gh_variable_get Retrieves a variable from a repository, environment, or organization. By default, it fetches from the repository scope. ```APIDOC ## GET /variable ### Description Retrieves a variable from a repository, environment, or organization. By default, it fetches from the repository scope. ### Method GET ### Endpoint /variable ### Parameters #### Path Parameters - **variable-name** (string) - Required - The name of the variable to retrieve. #### Query Parameters - **-e, --env** (string) - Optional - Get a variable for an environment. - **-q, --jq** (string) - Optional - Filter JSON output using a jq expression. - **--json** (fields) - Optional - Output JSON with the specified fields. - **-o, --org** (string) - Optional - Get a variable for an organization. - **-t, --template** (string) - Optional - Format JSON output using a Go template. - **-R, --repo** (string) - Optional - Select another repository using the [HOST/]OWNER/REPO format. ### JSON Fields - **createdAt** (string) - The creation timestamp of the variable. - **name** (string) - The name of the variable. - **numSelectedRepos** (integer) - The number of repositories selected for this variable (if applicable). - **selectedReposURL** (string) - The URL to the selected repositories for this variable (if applicable). - **updatedAt** (string) - The last update timestamp of the variable. - **value** (string) - The value of the variable. - **visibility** (string) - The visibility scope of the variable (e.g., 'repository', 'environment', 'organization'). ``` -------------------------------- ### GET /ruleset/check Source: https://cli.github.com/manual/gh_ruleset_check View information about GitHub rules that apply to a given branch or the default branch. ```APIDOC ## GET gh ruleset check ### Description View information about GitHub rules that apply to a given branch. The branch name does not need to exist; rules will be displayed that would apply to a branch with that name. If no branch name is provided, the current branch is used. ### Endpoint gh ruleset check [] [flags] ### Parameters #### Path Parameters - **branch** (string) - Optional - The name of the branch to check rules for. #### Query Parameters - **--default** (flag) - Optional - Check rules on the default branch. - **-w, --web** (flag) - Optional - Open the branch rules page in a web browser. - **-R, --repo** (string) - Optional - Select another repository using the [HOST/]OWNER/REPO format. ### Request Example $ gh ruleset check my-branch --repo owner/repo ``` -------------------------------- ### Filter gh status output Source: https://cli.github.com/manual/gh_status Examples for excluding specific repositories or limiting results to an organization. ```bash $ gh status -e cli/cli -e cli/go-gh # Exclude multiple repositories $ gh status -o cli # Limit results to a single organization ``` -------------------------------- ### Create a GitHub Project Source: https://cli.github.com/manual/gh_project Use this command to create a new GitHub project. Specify the owner and a title for the project. ```bash $ gh project create --owner monalisa --title "Roadmap" ``` -------------------------------- ### Check and update all skills interactively Source: https://cli.github.com/manual/gh_skill_update This command initiates an interactive process to check for and update all installed skills. ```bash # Check and update all skills interactively $ gh skill update ``` -------------------------------- ### Add a deploy key command syntax Source: https://cli.github.com/manual/gh_repo_deploy-key_add The basic command structure for adding a deploy key to a repository. ```bash gh repo deploy-key add [flags] ``` -------------------------------- ### Update all skills without prompting Source: https://cli.github.com/manual/gh_skill_update This command updates all installed skills automatically without requiring user confirmation. ```bash # Update all without prompting $ gh skill update --all ``` -------------------------------- ### Generate Bash Completion Script Source: https://cli.github.com/manual/gh_completion Add this to your `~/.bash_profile` to enable bash completions. Ensure `bash-completion` is installed first. ```bash eval "$(gh completion -s bash)" ``` -------------------------------- ### Open repository in browser Source: https://cli.github.com/manual/gh_repo_view Opens the specified repository in the default web browser. ```bash # Viewing a repository in the browser ~/Projects$ gh repo view owner/repo --web Opening https://github.com/owner/repo/ in your browser. ~/Projects$ ``` -------------------------------- ### Unlink project from repository or team Source: https://cli.github.com/manual/gh_project_unlink Examples demonstrating how to unlink projects using owner, repository, or team flags. ```bash $ gh project unlink 1 --owner monalisa --repo my_repo ``` ```bash $ gh project unlink 1 --owner my_organization --team my_team ``` ```bash $ gh project unlink 1 ``` -------------------------------- ### Create a GitHub Repository with gh Source: https://cli.github.com/manual/gh_repo Use 'gh repo create' to initiate the creation of a new repository. ```bash $ gh repo create ``` -------------------------------- ### Search Repositories by Keywords Source: https://cli.github.com/manual/gh_search_repos Use this to find repositories matching a set of keywords or a specific phrase. ```bash gh search repos cli shell ``` ```bash gh search repos "vim plugin" ``` -------------------------------- ### View Open Pull Requests Source: https://cli.github.com/manual/examples Lists all open pull requests for the current repository. No special setup is required. ```bash # Viewing a list of open pull requests ~/Projects/my-project$ gh pr list Pull requests for owner/repo #14 Upgrade to Prettier 1.19 prettier #14 Extend arrow navigation in lists for MacOS arrow-nav #13 Add Support for Windows Automatic Dark Mode dark-mode #8 Create and use keyboard shortcut react component shortcut ~/Projects/my-project$ ``` -------------------------------- ### Open repository settings Source: https://cli.github.com/manual/gh_browse Opens the settings page for the current repository. ```bash # Open repository settings $ gh browse --settings ``` -------------------------------- ### Mark a project as a template Source: https://cli.github.com/manual/gh_project_mark-template Use this command to mark a specific project as a template. Ensure you provide the project number and the owner's login. ```bash gh project mark-template 1 --owner "github" ``` -------------------------------- ### GET gh repo list Source: https://cli.github.com/manual/gh_repo_list Lists repositories owned by a specific user or organization with various filtering and output options. ```APIDOC ## GET gh repo list ### Description List repositories owned by a user or organization. Note that the list will only include repositories owned by the provided argument. ### Endpoint gh repo list [] [flags] ### Parameters #### Path Parameters - **owner** (string) - Optional - The user or organization to list repositories for. #### Query Parameters - **--archived** (boolean) - Optional - Show only archived repositories. - **--fork** (boolean) - Optional - Show only forks. - **-q, --jq** (string) - Optional - Filter JSON output using a jq expression. - **--json** (string) - Optional - Output JSON with the specified fields. - **-l, --language** (string) - Optional - Filter by primary coding language. - **-L, --limit** (int) - Optional - Maximum number of repositories to list (default 30). - **--no-archived** (boolean) - Optional - Omit archived repositories. - **--source** (boolean) - Optional - Show only non-forks. - **-t, --template** (string) - Optional - Format JSON output using a Go template. - **--topic** (strings) - Optional - Filter by topic. - **--visibility** (string) - Optional - Filter by repository visibility: {public|private|internal}. ### Response #### Success Response (200) - **JSON Fields** - The command returns objects containing fields such as: archivedAt, createdAt, description, forkCount, id, isArchived, isFork, isPrivate, name, owner, primaryLanguage, stargazersCount, updatedAt, url, visibility, and watchers. ``` -------------------------------- ### List Projects Source: https://cli.github.com/manual/gh_project_list Use this command to list the projects associated with the current user. No additional flags are required for basic usage. ```bash gh project list ``` -------------------------------- ### Get the percentage of forks for the current user Source: https://cli.github.com/manual/gh_api Calculates the percentage of forked repositories for the authenticated user using GraphQL and `jq`. ```APIDOC ## Get the percentage of forks for the current user ### Description Calculates the percentage of forked repositories among all repositories owned by the authenticated user. This involves fetching repository data via GraphQL and processing it with `jq`. ### Method `gh api graphql` ### Parameters #### Flags - `--paginate` - Enables pagination for fetching all repositories. - `--slurp` - Slurps all paginated results into a single JSON array. - `-f query='...'` - The GraphQL query string to fetch repository information, including `isFork`. ### GraphQL Query (partial, used within the command) ```graphql query($endCursor: String) { viewer { repositories(first: 100, after: $endCursor) { nodes { isFork } pageInfo { hasNextPage endCursor } } } } ``` ### `jq` Processing (example) ```jq def count(e): reduce e as $_ (0;.+1); [.[].data.viewer.repositories.nodes[]] as $r | count(select($r[].isFork))/count($r[]) ``` ### Example ```bash $ gh api graphql --paginate --slurp -f query='...' | jq '...' ``` ``` -------------------------------- ### Create Release Source: https://cli.github.com/manual/gh_help_reference Creates a new release with options for draft, prerelease, notes, and target branch. Can automatically generate notes. ```bash gh release create [] [... | ...] --discussion-category string Start a discussion in the specified category -d, --draft Save the release as a draft instead of publishing it --fail-on-no-commits Fail if there are no commits since the last release (no impact on the first release) --generate-notes Automatically generate title and notes for the release via GitHub Release Notes API --latest Mark this release as "Latest" (default [automatic based on date and version]). --latest=false to explicitly NOT set as latest -n, --notes string Release notes -F, --notes-file file Read release notes from file (use "-" to read from standard input) --notes-from-tag Fetch notes from the tag annotation or message of commit associated with tag --notes-start-tag string Tag to use as the starting point for generating release notes -p, --prerelease Mark the release as a prerelease --target branch Target branch or full commit SHA (default [main branch]) -t, --title string Release title --verify-tag Abort in case the git tag doesn't already exist in the remote repository ``` -------------------------------- ### View Repository Source: https://cli.github.com/manual/gh_help_reference View a repository. Options include viewing a specific branch, filtering JSON output, or opening the repository in the browser. ```bash -b, --branch string View a specific branch of the repository -q, --jq expression Filter JSON output using a jq expression --json fields Output JSON with the specified fields -t, --template string Format JSON output using a Go template; see "gh help formatting" -w, --web Open a repository in the browser ``` -------------------------------- ### Configure git credential helper for all hosts Source: https://cli.github.com/manual/gh_auth_setup-git Use this command to set up GitHub CLI as the credential helper for all hosts that you are authenticated with. If no hosts are authenticated, the command will fail. ```bash gh auth setup-git ``` -------------------------------- ### gh auth setup-git Source: https://cli.github.com/manual/gh_auth_setup-git Configures git to use GitHub CLI as the credential helper for all authenticated hosts. If no hosts are authenticated, the command will fail. Use the --hostname flag to specify a single host. ```APIDOC ## gh auth setup-git ### Description Configures `git` to use GitHub CLI as a credential helper. For more information on git credential helpers, please reference: https://git-scm.com/docs/gitcredentials. By default, GitHub CLI will be set as the credential helper for all authenticated hosts. If there is no authenticated host, the command fails with an error. Alternatively, use the `--hostname` flag to specify a single host to be configured. If the host is not authenticated with, the command fails with an error. ### Options - `-f`, `--force ` Force setup even if the host is not known. Must be used in conjunction with --hostname. - `-h`, `--hostname ` The hostname to configure git for. ### Examples ``` # Configure git to use GitHub CLI as the credential helper for all authenticated hosts $ gh auth setup-git # Configure git to use GitHub CLI as the credential helper for enterprise.internal host $ gh auth setup-git --hostname enterprise.internal ``` ### See also * gh auth ``` -------------------------------- ### Post an issue comment Source: https://cli.github.com/manual/gh_api Example of posting a comment to an issue using the gh api command with the '-f' flag for the body. ```bash # Post an issue comment $ gh api repos/{owner}/{repo}/issues/123/comments -f body='Hi from CLI' ``` -------------------------------- ### View Current Default Repository Source: https://cli.github.com/manual/gh_repo_set-default Use the `--view` flag to display the currently configured default repository. ```bash gh repo set-default --view ``` -------------------------------- ### Remove gh copilot CLI Source: https://cli.github.com/manual/gh_copilot Remove the GitHub Copilot CLI if it was installed through `gh`. This command is only supported on Windows, Linux, and Darwin. ```bash # Remove the Copilot CLI (if installed through gh) $ gh copilot --remove ``` -------------------------------- ### Create LICENSE.md with MIT license Source: https://cli.github.com/manual/gh_repo_license_view This command views the MIT license and redirects its content to a file named LICENSE.md. ```bash gh repo license view MIT > LICENSE.md ``` -------------------------------- ### Create Agent Task with Editor Source: https://cli.github.com/manual/gh_agent-task_create If no task description is provided and no file is specified, the command will open an editor for you to compose the task description interactively. ```bash gh agent-task create ``` -------------------------------- ### View Repository License Source: https://cli.github.com/manual/gh_help_reference View a specific repository license. Use the --web flag to open the license details on choosealicense.com in your browser. ```bash -w, --web Open https://choosealicense.com/ in the browser ``` -------------------------------- ### Format authentication status as JSON Source: https://cli.github.com/manual/gh_auth_status To get the authentication status in JSON format, use the `--json` flag with the desired fields, such as 'hosts'. ```bash gh auth status --json hosts ``` -------------------------------- ### Clone Repository by OWNER/REPO Syntax Source: https://cli.github.com/manual/examples Clone a GitHub repository using the OWNER/REPO format. This is a straightforward way to get a copy of a repository locally. ```bash # Cloning a repository ~/Projects$ gh repo clone cli/cli Cloning into 'cli'... ~/Projects$ cd cli ~/Projects/cli$ ``` -------------------------------- ### Create a public gist from a file Source: https://cli.github.com/manual/gh_gist_create Use the `--public` flag to make the gist publicly listed. Specify the filename to be uploaded. ```bash $ gh gist create --public hello.py ``` -------------------------------- ### List Issues by Author Source: https://cli.github.com/manual/gh_issue_list Filter issues by specifying the author using the --author flag. This example lists issues authored by 'monalisa'. ```bash gh issue list --author monalisa ``` -------------------------------- ### Create Agent Task with Inline Description Source: https://cli.github.com/manual/gh_agent-task_create Use this command to create a new agent task with a description provided directly on the command line. This is the most straightforward way to initiate a task. ```bash gh agent-task create "build me a new app" ``` -------------------------------- ### Link Project to Team Source: https://cli.github.com/manual/gh_project_link Example of linking a project to a specific team. The --owner and --team flags are used to specify the target. ```bash # Link monalisa's organization's project 1 to her team "my_team" $ gh project link 1 --owner my_organization --team my_team ``` -------------------------------- ### Open repository home page Source: https://cli.github.com/manual/gh_browse Opens the main page of the current repository in the default web browser. ```bash # Open the home page of the current repository $ gh browse ``` -------------------------------- ### Create a Precompiled Non-Go GitHub CLI Extension Source: https://cli.github.com/manual/gh_extension_create Create a new extension named 'foobar' that is precompiled using a language other than Go. This is for extensions compiled with other toolchains. ```bash gh extension create --precompiled=other foobar ``` -------------------------------- ### Create a gist from multiple files using patterns Source: https://cli.github.com/manual/gh_gist_create Use shell wildcards to select multiple files for your gist. This is convenient for uploading sets of files like all markdown or text files. ```bash $ gh gist create *.md *.txt artifact.* ``` -------------------------------- ### Enable Issues and Wiki Source: https://cli.github.com/manual/gh_repo_edit Use this snippet to enable both the issues and wiki features for a repository. ```bash gh repo edit --enable-issues --enable-wiki ``` -------------------------------- ### gh extension upgrade { | --all} [flags] Source: https://cli.github.com/manual/gh_help_reference Upgrade installed extensions. Can upgrade all extensions or a specific one. Supports dry-run and force options. ```APIDOC ## `gh extension upgrade { | --all} [flags]` ### Description Upgrade installed extensions. ### Flags - `--all` - Upgrade all extensions - `--dry-run` - Only display upgrades - `--force` - Force upgrade extension ``` -------------------------------- ### Upload a release asset with a display label Source: https://cli.github.com/manual/gh_release_create Upload a specific file as a release asset and assign it a custom display label using the '#` syntax. ```bash # Upload a release asset with a display label $ gh release create v1.2.3 '/path/to/asset.zip#My display label' ```