Skip to content

Creates a simple local proxy for raw.githubusercontent.com

Notifications You must be signed in to change notification settings

manojpsw/raw-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

raw-github

Creates a simple local proxy for raw.githubusercontent.com and makes both public private repository raw files available via the same domain and url structure.

This was created to temporarily work around a clib limitation ( #107, #105, #51) because of which right now you can only use public github repositories as clib dependencies.

Until clib is improved to allow private Github repos, the below, admitedly clunky, setup can help you develop clib enabled libraries for internal projects.

Setup

With a recent version of ruby and the bundler gem installed, clone this repo and run:

bundle install

This will install the ruby libraries (specified in our Gemfile) that we're using to run this proxy.

To authenticate with the Github API create a Github Personal Access Token with repo access.

To start the proxy run the following command, replace <token> with your Personal Access Token

GITHUB_ACCESS_TOKEN=<token> \
  bundle exec thin \
    --rackup config.ru \
    --port 3000 \
    start

This will make raw files from github repositories (public and private) available on a local web server running at localhost:3000, for example http://localhost:3000/clibs/list/master/package.json

Now redirect all requests intended for raw.githubusercontent.com to localhost:3000. On MacOS you can set this up as follows (the same should be possible on Linux with ipconfig).

sudo ifconfig lo0 10.0.0.1 alias
sudo ipfw add fwd 127.0.0.1,3000 tcp from me to 10.0.0.1 dst-port 80
echo '10.0.0.1  raw.githubusercontent.com' | sudo tee -a /etc/hosts

Finally, the current version of clib requests raw files from Github using HTTPS https://raw.githubusercontent.com and not HTTP. Normally, this is great but it would've been a lot more work to support HTTPS in this proxy so I've forked clib with a minor change to request via HTTP. Compile and use this forked version of clib to benefit from this proxy.

About

Creates a simple local proxy for raw.githubusercontent.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages