With the npm example, you can tell npm to use github's package repo instead of npmjs.com, and install from or publish to that one instead. Basically another npm, but the same command line app.
Another reason would be having a few private packages and not wanting to manage an entire npm account for them.