Reputation: 369
I have a few repositories on my Github account and I am trying to pipe a list of names of all these repos (private and public) to some scripts for automating a few tasks.
What I did-
git remote
or similar commands that I found are irrelevant to the problem. I still checked out its examples to be sure about this. Few others answered how to list locally stored repos but that would mean cloning each of them. I believe these two don't make this a duplicate question.Any ideas?
Upvotes: 2
Views: 1554
Reputation: 3238
This is now possible using github's cli. For instance, on Ubuntu this works:
sudo snap install gh
gh auth login
$ gh repo list tpope
Showing 30 of 84 repositories in @tpope
tpope/vim-dadbod dadbod.vim: Modern database interface for Vim public 1d
tpope/vim-fugitive fugitive.vim: A Git wrapper so awesome, it should be illegal public 2d
tpope/vim-unimpaired unimpaired.vim: Pairs of handy bracket mappings public 2d
tpope/vim-commentary commentary.vim: comment stuff out public 8d
(...)
Integrating this into vim-fugitive would best be a separate question.
Upvotes: 1
Reputation: 76429
The only way to find this information is via the GitHub API (e.g., using this API call), which will require an HTTP client and some JSON parsing. Usually, this will be done via curl
and jq
, but you can also do it with a language such as Ruby.
This information isn't exposed by Git because Git doesn't expose the concept of having a single account on a server with multiple, discoverable repositories. Many sites hosting repositories don't have this concept, either. Fugitive is just a wrapper around Git, so it also doesn't have this concept, although there are extensions to support it working with GitHub that may provide this functionality.
Upvotes: 0