$npx -y skills add opendatahub-io/ai-helpers --skill git-shallow-cloneUse this skill to perform a shallow clone of a Git repository to a temporary location.
| 1 | # Shallow Clone |
| 2 | |
| 3 | Provides a script for creating a shallow clone of a Git repository to a temporary location. This skill should be used |
| 4 | to analyze repository contents locally instead of using web APIs. |
| 5 | |
| 6 | ## Usage |
| 7 | |
| 8 | Use the `scripts/shallow-clone.sh` script in this directory, for example: |
| 9 | |
| 10 | ```bash |
| 11 | ./scripts/shallow-clone.sh <repository_url> [<tag_or_branch>] |
| 12 | ``` |
| 13 | |
| 14 | The script will print the path to the cloned repository when done, for example: |
| 15 | |
| 16 | ```shell |
| 17 | $ ./scripts/shallow-clone.sh https://github.com/psf/requests.git |
| 18 | Cloning https://github.com/psf/requests.git (shallow, ref: HEAD) to /tmp/shallow-clone-DDqkuv... |
| 19 | /tmp/shallow-clone-DDqkuv/repo |
| 20 | ``` |
| 21 | |
| 22 | After analyzing the local repository, clean up the temporary directory with: |
| 23 | |
| 24 | ```shell |
| 25 | $ rm -rf <path_to_temporary_directory> |
| 26 | ``` |