The URL of the button is:
github-mac://openRepo/https://github.com/user/repo
Since Gists are repositories too, the URL for Gists would be:
github-mac://openRepo/https://gist.github.com/123456
Thus, your Javascript code is:
window.location = "github-mac://openRepo/" + document.location.href
And your bookmarklet code:
javascript:(function())();
To create this bookmarklet, simply go to Bookmarks Manager (or ⌥⌘B), and add your link:
This will now work for all Git repositories, even the normal ones.