LoginSignup
70

More than 5 years have passed since last update.

posted at

updated at

GitHubから特定のディレクトリだけを直接ダウンロード

git及びGitHubのAPIに,一部のディレクトリだけをダウンロードするための機能はありません.
ので,GitHubのsvn用のサポートを使います.
svn exportで指定したディレクトリがダウンロード出来ます.

$ svn export https://github.com/ユーザー名/リポジトリ名/trunk/ディレクトリ名1/ディレクトリ名2/...

e.x.
https://github.com/ros/rosdistro/docだけをダウンロードしたい場合:

svn export https://github.com/ros/rosdistro/trunk/doc  

ブランチ名を指定する場合

$ svn export https://github.com/ユーザー名/リポジトリ名/branches/ブランチ名/ディレクトリ名1/ディレクトリ名2

svnで利用できるディレクトリを表示

svn lsを使う

$ svn ls https://github.com/ユーザー名/リポジトリ名/branches/

※雑記

ブランチ名を指定せずにリポジトリ名/trunk/~でダウンロードした時,ダウンロードされるブランチがどこで決まるのかよく分からないんですよねー・・・
自分で試した時は/trunkの方でダウンロードされるブランチは,
/branches/ブランチ名からはアクセスできないようでした.

参考

http://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo
https://coderwall.com/p/o2fasg/how-to-download-a-project-subdirectory-from-github

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
70