简体   繁体   中英

How to list all my Github repositories, public and private in the terminal with git or in Vim with Fugitive?

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-

  • Read a lot of QnA on this, but most answers revolve around 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.
  • Browsed the git documentation, but nothing seemed to allow this operation
  • Thought about cloning the entire account (somewhere around 7gb..) Please dont make me do this

Any ideas?

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.

The only way to find this information is via the GitHub API (eg, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM