5

How to find empty repositories in Github under a certain account, we have a large number of git repositories and would like to know if there is an empty repo without any branches

0

1 Answer 1

5

Check if the repository has no branches -

Method : GET

Endpoint : https://api.github.com/repos/{repoOwner}/{repoName}/branches

this returns an array of branch details .e.g:

 { "name": "main", "commit": { "commit": { "sha": "....", "URL": "..." }, "protected": false }, { "name": "v-2.0.0", "commit": { "sha": "....", "URL": "..." }, "protected": false } ] 

If there are no branches then it returns an empty array - []

Additionally, you can get the repository list using

Method: GET

Endpoint : https://api.github.com/users/{username}/repos

Official Docs by GitHub - Read Here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.