用途:管理 GitHub 仓库的本地缓存,通常用于需要对代码库进行研究或分析的场景。缓存根目录固定为 temp/repo-cache/。
主要能力:
- 确保仓库可用且为最新。先检查目录是否存在:test -d temp/repo-cache/<name> && echo "exists" || echo "missing"。若缺失,则对默认分支做浅克隆:git clone --depth 1 <repo-url> temp/repo-cache/<name> --quiet。若已存在,则拉取最新提交:cd temp/repo-cache/<name> && git pull --quiet。
- 清理仓库。当不再需要或明确要求时删除缓存:rm -rf temp/repo-cache/<name>。
使用规则:始终以 temp/repo-cache/ 作为缓存根目录,不得克隆到其他位置;始终使用 --depth 1 浅克隆以节省磁盘与时间;一次只克隆当前任务所需的单个仓库。
限制:资料未提供其他功能、平台支持、收费或价格信息。