Update, December 2014: These steps are no longer necessary. GitHub added a button for changing a Gist’s privacy:
Gist is a great tool for sharing and storing snippets of code, notes, and any other text you want. It lets you create private or public Gists — basically, sets of text files.
Sadly, it’s not easy to switch a Gist from private to public (or vice versa). But you can do it with a little Git-fu, since each Gist is its own Git repo. Here’s how to do it.
Copy the Private Clone URL from the Gist’s page and clone the Gist to a temporary directory:
~ $ git clone firstname.lastname@example.org:PRIVATEGIST.git gist-private-temp ~ $ cd git-private-temp
From the Gist web interface, create a new public Gist. You’ll need to add some dummy text to a file in the Gist, because you can’t create a totally empty Gist. This placeholder file will be deleted in the next step.
Copy the Private Clone URL from this new public Gist. Add the public Gist as a remote in your cloned copy of the private Gist, and push to it. A forced push is required since the new Gist contains that placeholder file.
~/gist-private-temp/ $ git remote add public email@example.com:PUBLICGIST.git ~/gist-private-temp/ $ git push -f public
Finally, to get the new Gist content to appear on your Gist home page, you might need to go to the Gist’s page, edit it, and resave it without making any changes.
I was thinking about making a script to do this, but my understanding is that the necessary Gist API methods are only available in the Github API v3, which is not yet stable; and I couldn’t find any Github API libraries that support it yet.
Update, in March 2014: Github’s V3 API is now stable, and someday soon now I’ll get around to writing that script. Promise.