Skip to content

Instantly share code, notes, and snippets.

@possibilities
Last active February 28, 2026 15:07
Show Gist options
  • Select an option

  • Save possibilities/b573cca1324855b3b43f185087d259fc to your computer and use it in GitHub Desktop.

Select an option

Save possibilities/b573cca1324855b3b43f185087d259fc to your computer and use it in GitHub Desktop.
Testing gist with images in subdirectory

Gist Image Embedding Experiment

Findings

Directories: BLOCKED

Gists have a server-side pre-receive hook that rejects pushes containing directories:

remote: Gist does not support directories.
remote: These are the directories that are causing problems:
remote: images

Flat images with relative paths: WORKS

![Red](red.png) renders correctly when the PNG is a sibling file in the gist.

GitHub resolves relative paths to the raw URL automatically:

red.png → https://gist.github.com/USER/HASH/raw/COMMIT/red.png

Images also render standalone

Each PNG file in the gist gets its own section with an inline preview - GitHub detects the file type and renders it as an image automatically.

Demo

Red: Red

Blue: Blue

Green: Green

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