在 Windows 上安装 GitHub Cli 工具。
安装
在 Windows 上安装时需要使用 Scoop 或 Chocolatey 进行安装。
小贴士:具体安装教程请参考官方教程
Scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
小贴士:简易替代命令 iwr -useb get.scoop.sh | iex
可能会遇到以下报错
> Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop.
For example, to set the execution policy to 'RemoteSigned' please run :
'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'
执行命令修改安全策略
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
然后重新执行命令
> Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding ~\scoop\shims to your path.
'lastupdate' has been set to '2020-07-18T15:58:14.5576061+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.
GitHub Cli
安装
> scoop bucket add github-gh https://github.com/cli/scoop-gh.git
Checking repo... ok
The github-gh bucket was added successfully.
> scoop install gh
Updating Scoop...
Updating 'github-gh' bucket...
Updating 'main' bucket...
Checking repo... ok
The main bucket was added successfully.
Scoop was updated successfully!
Installing 'gh' (0.11.0) [64bit]
gh_0.11.0_windows_amd64.zip (5.7 MB) [===============================================================================================================] 100%
Checking hash of gh_0.11.0_windows_amd64.zip ... ok.
Extracting gh_0.11.0_windows_amd64.zip ... done.
Linking ~\scoop\apps\gh\current => ~\scoop\apps\gh\0.11.0
Creating shim for 'gh'.
'gh' (0.11.0) was installed successfully!
升级
> choco upgrade gh
用法
Work seamlessly with GitHub from the command line.
USAGE
gh <command> <subcommand> [flags]
CORE COMMANDS
issue: Create and view issues
pr: Create, view, and checkout pull requests
repo: Create, clone, fork, and view repositories
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
completion: Generate shell completion scripts
config: Manage configuration for gh
gist: Create gists
help: Help about any command
FLAGS
--help Show help for command
--version Show gh version
EXAMPLES
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
ENVIRONMENT VARIABLES
GITHUB_TOKEN: an authentication token for API requests. Setting this avoids being
prompted to authenticate and overrides any previously stored credentials.
GH_REPO: specify the GitHub repository in "OWNER/REPO" format for commands that
otherwise operate on a local repository.
GH_EDITOR, GIT_EDITOR, VISUAL, EDITOR (in order of precedence): the editor tool to use
for authoring text.
BROWSER: the web browser to use for opening links.
DEBUG: set to any value to enable verbose output to standard error. Include values "api"
or "oauth" to print detailed information about HTTP requests or authentication flow.
NO_COLOR: avoid printing ANSI escape sequences for color output.
LEARN MORE
Use "gh <command> <subcommand> --help" for more information about a command.
Read the manual at https://cli.github.com/manual
FEEDBACK
Fill out our feedback form https://forms.gle/umxd3h31c7aMQFKG7
Open an issue using “gh issue create -R cli/cli”
附录
参考链接
本文由 柒 创作,采用 知识共享署名4.0
国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间: 2024-01-05 14:52 PM