{{ message }}

Instantly share code, notes, and snippets.

# subfuzion/github-wiki-how-to.md

Last active Feb 21, 2021
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.

### 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.

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


For example:

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


## See related references

### danieljwoods commented Feb 14, 2018 • edited

 Thanks for this, very helpful. A minor and important correction: In section "How do I clone a GitHub wiki?" .. change git@github.com/myorg/myrepo.wiki.git to git@github.com:myorg/myrepo.wiki.git They differ in the first '/' in the first line becomes a ':'

### ankitpateledu commented Feb 14, 2018

 i tried git clone https://github.com/my/myrepo.wiki.git but it clones only wiki files not the project files. How do i clone repo with project files as well as with wiki files?

### weishang commented Feb 16, 2018

 Think of the project files and the wiki pages in separate repos. So I don't think it is possible.

### schroef commented May 1, 2018

 How do we edit our own wiki and add images, i dont want a folder in my repo containing images for the wiki part. If i look at some others they have a folder in the there Repo called '/raw/master/wiki/images/'

### weishang commented May 2, 2018

 clone your wiki repo add images to the images folder reference the images with [[images/MY_IMAGE.PNG]] (no backslash or dot before images) commit and push check page http://mikehadlow.blogspot.ca/2014/03/how-to-add-images-to-github-wiki.html

### ASPePeX commented May 7, 2018

 @ankitpateledu I did not try this but you should be able to reference your wiki as a submodule of your main repo (or the other way round). But this means everyone cloning your repo would also clone the wiki.

### bwl21 commented May 8, 2018

 How can i contribute to a wiki of a Project without being a collaborator. It seems that there is no pull request for the wiki repository.

 Nice 😄

### cyphunk commented Aug 21, 2018

 This no longer appears to work. I've tried changing the wiki from .md to .wiki extension. Either do not help. I've tried the following syntax as well: [[images/myimage.jpg]] [[/images/myimage.jpg]] [[/raw/master/images/myimage.jpg]] [[../raw/master/images/myimage.jpg]] [[../../raw/master/images/myimage.jpg]] [[blob/master/images/myimage.jpg]] [[/blob/master/images/myimage.jpg]] [[../blob/master/images/myimage.jpg]] [[../../blob/master/images/myimage.jpg]] [[Image:images/myimage.jpg]] [[Image:/images/myimage.jpg]] [[Image:/raw/master/images/myimage.jpg]] [[Image:../raw/master/images/myimage.jpg]] [[Image:../../raw/master/images/myimage.jpg]] [[Image:blob/master/images/myimage.jpg]] [[Image:/blob/master/images/myimage.jpg]] [[Image:../blob/master/images/myimage.jpg]] [[Image:../../blob/master/images/myimage.jpg]] 

### cyphunk commented Aug 21, 2018 • edited

 Correction, it works. Here is the results that work for .md or .wiki. Example assumes you've created a images directory in the wiki's repository with a image named myimage.jpg: .wiki: [[images/myimage.jpg]] [[/images/myimage.jpg]] markdown !()[] syntax will not work img tag works but only with relative path does not support figure and figcaption tags  .md: [[images/myimage.jpg]] [[/images/myimage.jpg]] ![](../../blob/master/images/myimage.jpg) the markdown syntax works but not relative paths img tag works but only with relative path 

### schroef commented Sep 27, 2018 • edited

 @cyphunk I tried a couple your square bracket version, i they dont work for me.None of the relative work for me actually, only the absolute paths This is also works, also a trick to prevent caching and updates working, add '?v_DATE' this helps prevent caching normally !['Example Rig Presets'](https://raw.githubusercontent.com/wiki/schroef/extra-image-list/images/extra-image-list.jpg?v26-09-2018)

### gwlucastrig commented Oct 2, 2018

 I'd like to post a wiki page that explains some of the math behind my software. And, as such, it would include a fair number of equations. Is there a good way to do that? Using images seems a bit cumbersome. Perhaps I could use a PDF file as a wiki page? Is this kind of thing just too far out-of-scope for what the GitHub wiki system handles?

### anatolebeuzon commented Oct 29, 2018

 Thanks @subfuzion! Though I believe it should be git@github.com:myorg/myrepo.wiki.git (: instead of /)

### JirkaDellOro commented Nov 4, 2018 • edited

 I wonder if it's possible to access a Github-Wiki or images/files included there through Github-pages...?

### steklopod commented Mar 19, 2019

 All my images are not showing: https://github.com/steklopod/Tour-of-Scala/tree/master/src/main/resources/images but it was! Why GitHub has deleted them?

### subfuzion commented Apr 5, 2019

 @danieljwoods @oxlay - thanks for the catch. Fixed the ssh url.

### derekriemer commented Jun 3, 2019

 Thanks @subfuzion! Though I believe it should be git@github.com:myorg/myrepo.wiki.git (: instead of /`) I'd like to post a wiki page that explains some of the math behind my software. And, as such, it would include a fair number of equations. Is there a good way to do that? Using images seems a bit cumbersome. Perhaps I could use a PDF file as a wiki page? Is this kind of thing just too far out-of-scope for what the GitHub wiki system handles? Does it come with mathjax? try $$x_1+x_2+x_3$$ or something and see if it renders.

### felixvd commented Nov 26, 2019 • edited

 I don't seem to have access rights to the wiki, although I can push to the main repository just fine. Anyone had any issues like this? edit: You need to create the first wiki page before you can upload to it.

### shiyu99 commented Sep 4, 2020

 Hi, thank you for sharing your knowledge! One question though, the image part workred, but the pdf part didn't work for me: [Initial Architect](resources/Initial Architect (Screen Scratch).pdf "Initial Architect (Screen Scratch)") Is there a problem with my formatting

### dewcansam commented Sep 14, 2020

 2nd paragraph - word 29 wiki.get appended should be wiki.git appended