This GitHub CLI (gh) extension helps you to interactively find and pick one of your GitHub repositories.
With your repositories, I mean repositories you own at GitHub or have been given access to.
After you have selected a repository, the name is printed to stdout, so you can use it in scripts or pipe it to other commands.
The extension uses the fzf command-line fuzzy finder as UI to interactively search and select a repository.
The search syntax of fzf, gives you a powerful way to find the repository you want with a few keystrokes.
-
GitHub CLI (
gh) - minimum version (2.0.0) -
fzf(Installation instructions here)
gh extension install https://github.com/doeringp/gh-repo-pickerTo list all you GitHub repositories you have access to:
gh repo-pickerThe command opens the fzf interactive finder, where you can search and select a repository using fzf's powerful search syntax. If you've selected a repository, its name (in the format owner/repo) is printed to stdout.
The gh repo-picker command can easily be combined with other gh commands:
gh repo clone $(gh repo-picker)gh browse --repo $(gh repo-picker)The GitHub CLI supports aliases for custom commands. Create aliases for repository actions you use frequently to save time.
For example, create aliases for the commands above:
# Clone one of your repositories
gh alias set --shell clone 'gh repo clone $(gh repo-picker)'
# Open one of your repositories in the web browser
gh alias set --shell open 'gh browse --repo $(gh repo-picker) $@'
# Now you can use the aliases like this:
gh clone
gh open
gh open --settings # to jump directly to the settings page of the selected repositoryThe GitHub CLI supports GitHub Enterprise Server.
However the gh repo-picker command lists only your repositories from github.com by default. To use a GitHub Enterprise Server instance instead, set the GH_HOST environment variable:
export GH_HOST=<hostname>
gh repo-pickerNote
Make sure you have authenticated to the GitHub Enterprise Server instance with gh auth login --hostname <hostname> before.
