Skip to content

doeringp/gh-repo-picker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

gh-repo-picker

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.

Demo

Prerequisites

  1. GitHub CLI (gh) - minimum version (2.0.0)

  2. fzf (Installation instructions here)

Install the extension

gh extension install https://github.com/doeringp/gh-repo-picker

Usage

To list all you GitHub repositories you have access to:

gh repo-picker

The 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:

Clone a repository

gh repo clone $(gh repo-picker)

Open the repository in the browser

gh browse --repo $(gh repo-picker)

Aliases (Recommended)

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 repository

GitHub Enterprise Server

The 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-picker

Note

Make sure you have authenticated to the GitHub Enterprise Server instance with gh auth login --hostname <hostname> before.

About

GitHub CLI extension to quickly pick one of your repositories using fuzzy search and clone it or open it in the browser.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Shell 100.0%