Saturday, July 12, 2014

QuickTip: private GitHub repositories for free

Here's a quicktip for bargainers: if you want to host some code (or binary files, even) on a private GitHub repository but don't want to afford a paid plan, you can simply create a secret gist at gist.github.com and use that as a full-blown git repository. It is not a full-blown GitHub repository as you know it though. No pull requests, no issues, etc - but commits, diffs, branches, ...!

You can find the clone URL in the lower right corner of a gist-page. You can use that like you always do with "git clone URL" to get started pushing your code to GitHub. Make sure to use the SSH clone URL if you don't want to enter a password for every commit.

Edit: as pointed out by +Michael Haubenwallner in the comments, gists do not have access control like real GitHub repositories. This means that even if you create a "secret gist", everyone who knows the clone URL has access to your code! This is great for sharing code, but bad if you store sensitive data in your gist...

Edit edit: Oh well, turns out gists do not support directories. I was told BitBucket offers free private repositories though - directories supported! ;)