Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Last active April 20, 2024 09:22
Show Gist options
  • Save subfuzion/0d3f19c4f780a7d75ba2 to your computer and use it in GitHub Desktop.
Save subfuzion/0d3f19c4f780a7d75ba2 to your computer and use it in GitHub Desktop.
GitHub Wiki How-To

How do I clone a GitHub wiki?

Any GitHub wiki can be cloned by appending wiki.git to the repo url, so the clone url for the repo https://myorg/myrepo/ is: git@github.com:myorg/myrepo.wiki.git (for ssh) or https://github.com/my/myrepo.wiki.git (for https).

You make edits, and commit and push your changes, like any normal repo. This wiki repo is distinct from any clone of the project repo (the repo without wiki.get appended).

How do I add images to a wiki page?

You need to clone the wiki repo and edit it on your system.

Add images to an images directory (or subdirectory below it) in your wiki repo. For example: images/project-architecture/project-architecture-overview.png.

In your wiki page markup, embed an image link in the following format:

[[/images/path/to/image.ext|ALT TEXT]]

Note the leading / in the path. You don't need it if all your wiki docs and image files are located at the top level of the wiki (like when you use the online wiki editor), but if you are working with a clone of the wiki, then you can organize files in subdirectories; and in that case, absolute or relative path specifiers are critical so that the path to the image resolves correctly when editing a doc that is located in a different subdirectory.

Commit and push your changes.

Note

This is not the same as providing a link to an image that is part of your project repo (not the wiki repo). If you want to link to an image in your project repo, you will need a full URL that looks something like this:

[[https://github.com/username/repository/blob/master/img/octocat.png|alt=octocat]]

See references, below.

How do I add files to a wiki page?

You need to clone the wiki repo and edit it on your system.

Add files to the files directory (or subdirectory below it). For example: files/project-presentation.pdf`.

In your wiki page markup, add the file link in the following format:

[link text](files/path/to/file "ALT TEXT")

For example:

[Project Presentation](files/project-presentation.pdf "Project Presentation PDF")

Commit and push your changes.

See related references

@michalradacz
Copy link

Hi, little stupid questionn: How to clone private wiki? I have private repo with private wiki, on web github.com all works done, but your workflow for Github desktop does not work. Any ideas? - and, YES, i am logged in and I am logged as me in Github desktop, all private repos works well, but no wikis.

@kosperera
Copy link

kosperera commented Jun 29, 2022

How I usually add images to wiki or any markdown is:

  1. Create a new issue in a repo
  2. Drag and drop the files from the local file system to the issue text area
    GitHub will upload the file to their CDN, then generates a markdown code snippet for you
  3. Copy the auto-generated code snippet, then paste where I wanna use
  4. Discard the new issue or save it
    Depends on what I wanna do with the list of images I uploaded.

@shadu120
Copy link

Unfortunately, this solution not work. When I tried to clone my private repo's. wiki , I got error mesages:

git clone git@github.com:abc-com/aaaaa.wiki.git
Cloning into 'aaaaa.wiki'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


 git clone https://github.com/abc-com/aaaaa.wiki.git
Cloning into 'aaaaa.wiki'...
remote: Repository not found.
fatal: repository 'https://github.com/abc-com/aaaaa.wiki.git/' not found

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