Search code examples
githubgist

How do I duplicate a gist?


I have a gist which is managed by an IDE extension. Now I want to have two different setups, starting with the current setup as base. How do I duplicate my existing gist? There doesn't seem to be any relevant option on GitHub.


Solution

  • Gists are basically git repositories with all files at root directory. Unfortunately there is no way to easily duplicate a gist through Github UI. We need to go through these steps:

    1. Create the destination gist: Add random stuff as part of it, we just need a gist id.
    2. Clone source gist & force push to destination gist:
      cd /tmp
      git clone [email protected]:<source-gist-id>.git source-gist
      cd source-gist
      git push --force [email protected]:<destination-gist-id>.git