2013-10-14 16 views
5

Githubで保護されたリポジトリにあるプロジェクトのインストールスクリプトをダウンロードしようとしています。ファイルのみをGithub PROTECTEDリポジトリから取得する方法

userおよびrepoは、正しい情報で置き換えられます。

私はカールを試してみました:

curl -u gabipetrovay -L -o install.sh "https://raw.github.com/user/repo/master/admin/scripts/install.sh" 

カールはすぐに私はそれが(おそらくのGithubからJSの多くの)何かをさらに行くとダウンロードの最初の文字を入力すると、パスワードの入力を求められますが、

を私はまた、wgetの試してみました:wgetので

wget --user=gabipetrovay --ask-password "https://raw.github.com/user/repo/master/admin/scripts/install.sh" 

を私は私の完全なパスワードを入力することができますが、その後、私は503エラーを取得する:

Resolving raw.github.com (raw.github.com)... 199.27.73.133 
Connecting to raw.github.com (raw.github.com)|199.27.73.133|:443... connected. 
HTTP request sent, awaiting response... 503 Connection timed out 
2013-10-14 10:18:45 ERROR 503: Connection timed out. 

install.shファイルはどのように入手できますか?そこに説明したようにあなたはOAuthのトーク​​ンを作成する必要が

+1

が重複する可能性を[どのように私は、コマンドラインを使用して、民間のGitHubリポジトリから単一のRAWファイルをダウンロードすることができますか?](のhttp:// stackoverflowの.com/questions/18126559/how-can-i-download-a-single-raw-file-from-a-private-github-repo-using-the-comman) –

答えて

0

(私はUbuntuのサーバ13.04からこれを実行しています):Github basic authentication

、あなたは、次のコマンドを使用することができ、「あなたが使用する必要があるので、一時的なURLを取得カールリダイレクトをフォローするカールで-L」:

curl -L -u <your token>:x-oauth-basic https://raw.github.com/user/repo/master/admin/scripts/install.sh 

ます。また、ディスク

+0

これを試してみましたが、これは動作しません。 503エラーが発生します(リダイレクトの場合も同じです) –

5

に保存するには、-o 『ファイル名』を使用することができますし、Githubのみんなからの公式の応答は次のとおりです。

Thanks for getting in touch! For this case, you'll want to use our API to download individual files:

http://developer.github.com/v3/repos/contents/#get-contents

With this endpoint, you can get a specific file like this:

curl -u gabipetrovay -H "Accept: application/vnd.github.raw" "https://api.github.com/repos/user/repo/contents/filename" 

You'll just be prompted for your GitHub account password in this case, or you can also use an OAuth token as well. For reference, our API Getting Started Guide has a nice section on authentication:

http://developer.github.com/guides/getting-started/#authentication

これは魅力的です!

おかげでロバート@ Githubの

2

あなたは(あなたがOAuthのトーク​​ンが必要です)このような生のファイルを取得するために、V3のAPIを使用することができます。

curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path

このすべてが行かなければなりません1行に-Oオプションは、ファイルを現在のディレクトリに保存します。 -o filenameを使用して別のファイル名を指定することができます。 https://help.github.com/articles/creating-an-access-token-for-command-line-use

あなたは、言って、シェルスクリプトからこれを実行する必要がある場合、これは、より良い自動化することができます:ここでの指示に従ってくださいOAuthのトーク​​ンを取得するには

私も要旨としてこれを書いている:の https://gist.github.com/madrobby/9476733

関連する問題