README.md

js-github

It's implemented as a js-git mixin that implements the storage backend
using Github's Git Data API using REST calls.

This will work in the browser or in node.js. Technically an access token isn't
required to read public repositories, but you will be rate-limited to a very
small amount of requests per hour. With an auth token, you will be able to do
more, and depending on the access of the token you can read private repos or
write to repos.

I highly reccommend using a local cache in IndexedDB or LevelDB or something
available on your platform. This way you never request resources you've asked
for before and can do more work without hitting the rate limit.

Here is a sample config for a chrome app that uses IDB for a local cache:

Note that this backend does not provide loadRaw or saveRaw and can't be used
with the pack-ops mixin required for clone, push, and pull. The good news is
you don't need those since all changes are happening on github directly. If you
want to "push" a new commit, simply update the ref on the repo and it will be
live.

So, here is an example to load README.md from an existing repo, change it to
all uppercase the save it back as a new commit.

At this point, the new data is live on github, but not visible as it if wasn't
pushed. If we want to make the change permanent, we need to create a new commit
and move the master ref to point to it.

var commitHash =yieldrepo.saveAs("commit", {
tree: treeHash,
author: {
name:"Tim Caswell",
email:"tim@creationix.com"
},
parent: headHash,
message:"Change README.md to be all uppercase using js-github"
});
// Now we can browse to this commit by hash, but it's still not in master.// We need to update the ref to point to this new commit.yieldrepo.updateRef("refs/heads/master", commitHash);
});