Linux command
gh-auth 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Login to GitHub
gh auth login
Login with specific host
gh auth login --hostname [github.example.com]
Check authentication status
gh auth status
Logout from GitHub
gh auth logout
Refresh authentication
gh auth refresh
说明
gh auth manages authentication for the GitHub CLI. It handles OAuth device flow, personal access tokens, and SSH key authentication across multiple GitHub hosts. The command stores credentials securely in the system keychain when available, falling back to encrypted file storage. It supports github.com and GitHub Enterprise Server instances simultaneously. gh auth provides the foundation for all authenticated gh operations.
参数
- login
- Authenticate with a GitHub host.
- logout
- Log out of a GitHub host.
- status
- View authentication status.
- refresh
- Refresh stored credentials.
- token
- Print authentication token.
- --hostname _HOST_
- GitHub hostname (for Enterprise).
- --web
- Open browser for authentication.
- --with-token
- Read token from stdin.
- --help
- Display help information.
FAQ
What is the gh-auth command used for?
gh auth manages authentication for the GitHub CLI. It handles OAuth device flow, personal access tokens, and SSH key authentication across multiple GitHub hosts. The command stores credentials securely in the system keychain when available, falling back to encrypted file storage. It supports github.com and GitHub Enterprise Server instances simultaneously. gh auth provides the foundation for all authenticated gh operations.
How do I run a basic gh-auth example?
Run `gh auth login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does login do in gh-auth?
Authenticate with a GitHub host.