복제하지 않고 git 저장소의 모든 파일 가져오기

복제하지 않고 git 저장소의 모든 파일 가져오기

다음을 수행할 수 있는 기존 도구가 있습니까?

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

관련 정보