Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all filenames under a directory using github api?

Tags:

git

github

I need to list all the file names under a directory of my repository.

The following api can list filenames and directories from root directory.

https://api.github.com/repos/username/repo-name/git/trees/master?recursive=1

Found no appropriate api to list directory wise!

like image 811
zeromsi Avatar asked Oct 12 '25 09:10

zeromsi


1 Answers

Use https://api.github.com/repos/{owner}/{repo}/contents/{path}

See documentation here: https://docs.github.com/en/rest/reference/repos#get-repository-content

like image 187
TheIceBear Avatar answered Oct 15 '25 13:10

TheIceBear