![복제하지 않고 git 저장소의 모든 파일 가져오기](https://linux55.com/image/182722/%EB%B3%B5%EC%A0%9C%ED%95%98%EC%A7%80%20%EC%95%8A%EA%B3%A0%20git%20%EC%A0%80%EC%9E%A5%EC%86%8C%EC%9D%98%20%EB%AA%A8%EB%93%A0%20%ED%8C%8C%EC%9D%BC%20%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0.png)
다음을 수행할 수 있는 기존 도구가 있습니까?
git-cat https://github.com/AbhishekSinhaCoder/Collection-of-Useful-Scripts
then it will run cat on each file in the repo?
다음과 같은 방법이 작동하지만 파일이 분리되지는 않습니다.
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ |
jq .[].download_url -r |
xargs curl 2>/dev/null |
bat
답변1
이는 명령줄을 몇 가지만 수정하면 달성할 수 있습니다.
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ |
jq .[].download_url -r |
xargs -L1 sh -c 'curl "$0" 2>/dev/null | bat'
그러나 파일 수가 많은 경우 요청을 너무 많이 하여 속도가 제한되거나 페이징으로 인해 결과가 불완전할 수 있습니다. 전체 복제 비용이 발생하지 않으려면 얕은 복제( git clone --depth=1
) 또는 부분 복제( )를 수행하는 것이 좋습니다.git clone --filter=blob:none