Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active November 21, 2023 05:48
Show Gist options
  • Save YumaInaura/7a82df5a1dfe3bf90575191ea1ceee5a to your computer and use it in GitHub Desktop.
Save YumaInaura/7a82df5a1dfe3bf90575191ea1ceee5a to your computer and use it in GitHub Desktop.
Gist — Manage in one repository many gists by using git submodule

Gist — Manage in one repository many gists by using git submodule

Gist is a nice service. We can write code so easily and manage files as repository.

But bad points are …

  • Many repository
  • Gist destributes random hash to perticular gists (repositories).
    • So difficult to find or remember contents as repository.

So let's manage them in one normal Github repository.

Create Github normal repository ( for aggregate many gists )

Example:

https://github.com/YumaInaura/gist

Create gist

From web

image.png

Distributed Gist URL example:

https://gist.github.com/YumaInaura/8d52e73dac7dc361745bf568c3c4ba37

Add gist repository to aggregation repository by git submodule

Command:

git submodule add [Gist URL] [Some directory name easy to remember]

Example:

git submodule add https://gist.github.com/YumaInaura/8d52e73dac7dc361745bf568c3c4ba37 understandhing_channel_buffer

Commit and push to aggregation repository

Then we can manage "submodule managed repositories".

Github view

We can find link from aggregation repository to gist.

image.png

image.png

Example page:

https://github.com/YumaInaura/gist/tree/master/go

Clone aggregation repository

Use --recurse-submodules option then we can clone all submodule managed files.

Exmaple:

git clone --recurse-submodules https://github.com/YumaInaura/gist

Careful, If include many submodules, then many clones happens.

@codingedgar
Copy link

I added:

host gist.github.com
 HostName gist.github.com
 IdentityFile {path to key}
 User git

to my ~/.ssh/config and now it's working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment