Vlad Balanescu
Vlad Balanescu

Reputation: 674

Bash to get JSON doc from Github

I am trying to do a curl to basically clone a package.json in my local directory, by using:

curl -U "<email>":"<pass>" -L "https://github.com/flowrepo/blob/master/package.json" 

I managed to get pass the redirect by using the -L flag, but I cannot get a valid JSON doc as the command above is returning the entire Github page. Any thoughts?

Upvotes: 0

Views: 24

Answers (2)

Vlad Balanescu
Vlad Balanescu

Reputation: 674

[Solved]

Thanks Hans Z. for your answer. This is the final call that works:

curl -U "<email>":"<pass>" -L "https://github.com/flowrepo/raw/master/package.json?token<retrieved_token> -o output.txt

Upvotes: 0

Hans Z.
Hans Z.

Reputation: 53908

Access the "raw" variant by changing the URL to: https://github.com/flowrepo/raw/master/package.json"

Upvotes: 1

Related Questions