[英]Getting a list of files / file tree on remote git repo
I did a clone of a remote without a checkout:我做了一个没有结帐的遥控器克隆:
git clone -n git@github.com:RobKohr/awesome-repo.git
and can clone an individual file:并且可以克隆单个文件:
git checkout HEAD README.md
but I would like to get a list of all the files in the repo without fetching the files themselves.但我想在不获取文件本身的情况下获取 repo 中所有文件的列表。
Is there a way to do this?有没有办法做到这一点?
This is for a rather large private github repo that I only have ssh deploy access to (not web access), and I don't want to check out the whole thing.这是一个相当大的私有 github 存储库,我只有 ssh 部署访问(不是 web 访问),我不想检查整个事情。 I want to get the file list so I can pick and choose.
我想获取文件列表,以便我可以选择。
There are only two ways to do that — either using clone or via Github API.只有两种方法可以做到这一点——使用克隆或通过 Github API。 If you don't have access to the API clone is the only solution.
如果您无权访问 API 克隆是唯一的解决方案。
You can speed things up a bit using shallow clone.您可以使用浅克隆加快速度。 Do not clone the entire repository — clone only the last commit into a bare repository and run
git ls-tree
:不要克隆整个存储库 - 仅将最后一次提交克隆到裸存储库并运行
git ls-tree
:
git clone --bare --depth=1 git@github.com:RobKohr/awesome-repo.git
cd awesome-repo.git
git ls-tree --name-only -r HEAD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.