如何使用 gitlab api 获取子文件夹和文件 [英] How to get subfolders and files using gitlab api
问题描述
我正在使用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.
请告诉我.
提前致谢,马利卡朱那
推荐答案
根据API,我们可以使用
GET/projects/:id/repository/tree
列出项目中的文件和目录.但是我们只能通过这种方式获取repo顶层的文件和目录,以及带有参数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 获取子文件夹和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!