问题描述
我正在使用gitlab api来获取文件和文件夹并成功,
I am using gitlab api to get the files and folders and succeded,
但是我只能获取目录名称,而不能获取其子文件夹和文件.
But I can able to get only directory names, not its subfolders and files.
所以,我如何获得存储库的完整树.
So, how can i get full tree of my repository.
请让我知道.
预先感谢,Mallikarjuna
Thanks in advance,Mallikarjuna
推荐答案
根据 API ,我们可以使用
GET /projects/:id/repository/tree
列出项目中的文件和目录.但是,我们只能通过这种方式在存储库的顶层获取文件和目录,并在顶层使用param path
来获取目录的子目录.
to list files and directories in a project. But we can only get the files and directories in top-level of the repo in this way, and sub-directories of directories in top-level with param path
.
例如,如果要获取script/js/components
的目录,则可以使用
If you wanna get directories of script/js/components
, for example, you can use
GET /projects/:id/repository/tree?path=script/js/components
这篇关于如何使用gitlab API获取子文件夹和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!