Directly embedding images into a Github wiki
Tue, Nov 15, 2016Although there’s a reasonable amount of posts saying that you have to upload a image to your repository (the code), and then link with the “raw” approach, my colleague and I found a more elegant solution:
Upload the image directly into the Wiki repository
Indeed the wiki is just another Git repo ! Here is the github page.
So basically you need first clone the wiki repo:
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
Then you add your image:
cp ~/myimage.png YOUR_REPOSITORY.wiki/
cd YOUR_REPOSITORY.wiki
git add myimage.png
git commit -m "added picture for the wiki"
git push
Your image is now available at
https://raw.githubusercontent.com/wiki/USERNAME/REPOSITORY/myimage.png
so you only need to link it in your Wiki using the regular link
[text]("https://raw.githubusercontent.com/wiki/USERNAME/REPOSITORY/myimage.png")