11

I've been using GitHub's gist feature for some very lightweight HTML + CSS + JavaScript experiments.

I don't have git on my laptop either as a commandline tool or via some IDE. (I'm hitchhiking around the world with a little netbook.)

Copying and pasting from my favourite text editor to/from Git works just fine.

I also have a proper GitHub account where I have forked some projects, edited little fixes right in the GitHub online editor and issues pull requests upstream. So far for the kind of stuff I'm doing the online tools or GitHub are fine without a commandline or IDE.

But now I'm wondering is there a way to "promote" something which is currently a gist into a full-fledged GitHub project?

0

3 Answers 3

3

You can now do this by using Import repository, just below New repository, and fill in the gist address.

enter image description here

7

There is no way to do this without the command line. GitHub does not have a way to promote gists into a repo.

While the GitHub interface does allow you to edit files in your repository, they have to already be there via a git push from your local.

Should they add the ability to add files via the web interface then you would be able to "promote" a gist into a GitHub repo via a standard copy and paste of its contents. But that would also not carry over any of the gist's history of commits.

If you still want to, you'll have to use the command line or IDE.

  1. Head to your gist and look for the Public/Private Clone URL
  2. Click it.

    You'll see a pop up with info such as this:

    Use this clone URL yourself.
    git clone [email protected]:{SHA-1}.git local-repo

  3. Run the git clone to your local

    You may be required to confirm the download if the authenticity of the host, gist.github.com, cannot be established.

    You may also have to enter your passphrase to connect to GitHub

  4. Update the remote to your GitHub repo, of where you want to push these files.

    git remote set-url origin {git://new.url.here}
    

Now you should be able to push the gist files into a GitHub repo, with all their commit revision history.

6
  • Hmm would such a "copy paste promotion" leave a continuous repo or fork or would it just start a new one that internally knew nothing of its origins? Sep 15, 2012 at 11:56
  • The latter, just a fresh copy with no history Sep 15, 2012 at 12:08
  • Hmm that's too bad, but with the commandline it would preserve the history, do I understand correctly? Sep 15, 2012 at 12:15
  • 1
    Sorry, no. All seen as fresh files, zero history. Doesn't matter if via the web interface or the command line. Sep 15, 2012 at 12:18
  • 2
    Sounds like a good idea to send over to GitHub as a feature request Sep 15, 2012 at 12:53
4

Well, gists are repositories in their own right - you can clone them, they have history.

Can you just create a repository on github, clone your gist, add the github repository as a new remote, then push to it? It should now contain your gist contents including revision history.

Pretty sure this would require the commandline or some other UI tool that lets you do specific git operations like adding remotes, pulling, and pushing, though.

1
  • 1
    Tested this and it sure enough works if you can use the command line Sep 15, 2012 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.