How to retrieve the list of all GitHub repositories of a person?

后端 未结 15 1268
一个人的身影
一个人的身影 2020-12-02 05:43

We are working on a project where we need to display all the projects of a person in his repository on GitHub account.

Can anyone suggest, how can I display the na

15条回答
  •  情书的邮戳
    2020-12-02 06:10

    Try the following curl command to list the repositories:

    GHUSER=CHANGEME; curl "https://api.github.com/users/$GHUSER/repos?per_page=100" | grep -o 'git@[^"]*'
    

    To list cloned URLs, run:

    GHUSER=CHANGEME; curl -s "https://api.github.com/users/$GHUSER/repos?per_page=1000" | grep -w clone_url | grep -o '[^"]\+://.\+.git'
    

    If it's private, you need to add your API key (access_token=GITHUB_API_TOKEN), for example:

    curl "https://api.github.com/users/$GHUSER/repos?access_token=$GITHUB_API_TOKEN" | grep -w clone_url
    

    If the user is organisation, use /orgs/:username/repos instead, to return all repositories.

    To clone them, see: How to clone all repos at once from GitHub?

    See also: How to download GitHub Release from private repo using command line

提交回复
热议问题