2016-10-06 5 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に変換されます。

関連する問題