2016-10-06 2 views
0

curl을 사용하여 특정 github 분기의 최신 버전을 다운로드하려고합니다.GitHub에서 tarball을 다운로드 할 때 최상위 디렉토리의 이름을 변경합니까?

curl -L https://github.com/nativescript/docs/tarball/production | tar zx 

그러나,이 모든 커밋의 이름이 변경됩니다 같은 코드에서 작업하기 어려운 whihc NativeScript-docs-ed0d16f와 같은 파일을 만듭니다. 해당 파일을 다운로드 할 수있는 방법이 있지만 명령 줄에서 docs-latest이라는 폴더를 찾으려면 어떻게해야합니까?

다운로드 한 파일의 이름을 모른 채?

+0

이것은 curl과 아무 관련이 없습니다. curl은 stdout에 쓰기 때문에 파일 이름에는 아무런 변화가 없습니다. –

답변

1

질문에 .../tarball/... 링크가 아닌 최신 .../archive/... 링크를 사용하십시오. 일반적인 형식은 다음과 같습니다 그래서

https://github.com/<group_or_organization>/<repo>/archive/<refspec>.tar.gz 

, 예를 들면 :

$ curl -L jttps://github.com/nativescript/docs/archive/production.tar.gz | tar tz 
docs-production/ 
docs-production/.gitattributes 
docs-production/.gitignore 
docs-production/.gitmodules 
docs-production/.vscode/ 
docs-production/.vscode/settings.json 
docs-production/README.md 
... 

당신은 생성 된 최상위 디렉토리의 이름이 오히려 커밋 ID로 변환보다, 제공 어떤 <refspec> 사용하고 있음을 알 수있다. 마찬가지로

:

$ curl -s -L https://github.com/nativescript/docs/archive/ErikEdits-css-annimations.tar.gz | tar tz 
docs-ErikEdits-css-annimations/ 
docs-ErikEdits-css-annimations/.gitattributes 
docs-ErikEdits-css-annimations/.gitignore 
... 

분기 이름 대신에 다른 gitrefspecs를 사용할 수 있습니다.

https://github.com/nativescript/docs/archive/HEAD^.tar.gz 

또는 : 예를 들어

https://github.com/nativescript/docs/archive/v2.3.0-20-ged0d16f.tar.gz 

그러나 이러한 경우

는 기준 은 커밋 ID로 변환 할 수됩니다.

관련 문제