There is an API for retrieving data content from github. This is part of the v3 github API .
You make a request
https://api.github.com/repos/{username}/{repository name}/contents/{filepath and name}
eg. https://api.github.com/repos/mono/monodevelop/contents/README
If you do not set the accepts header, you will get back some JSON with the contents of the file encoded in base64. You will have to decode this, which is very easy in node.js, but more pain in the browser. You can easily find base64 decoders in javascript in other questions on stackoverflow. One note: the base64 code you return from github has newline characters in it to make it formatted, and many base64 decoders cannot handle new lines, so you may need to delete them or change the decoder.
You probably just need content and you don't need other material in json (e.g. sha and length, etc.), so you can make your life easier by setting the Accept header to application/vnd.github.3.raw .
Here's an example with the accepts header using curl:
curl -i https://api.github.com/repos/mono/monodevelop/contents/README --header "Accept: application/vnd.github.3.raw"
Now, if you are using node or curl, perhaps this is good, but if you are working in a browser, you will need to use CORS for this. Github only allows access from hosts registered with OAuth Applications. This is not particularly difficult to do, but for my usecase (bookmarketlet) this is not an option.
There is a way to access without using CORS, and this is using JSONP, you can add, for example. ?callback=_processGithubResponse to get a javascript output suitable for inclusion with a script tag (which calls a function named _processGithubResponse with the response). Unfortunately, you cannot set the accepts header, so in this case you are stuck with the decoding base64.
If you are using node.js, I would recommend you use node-github , which makes using the API easier.