27

pictures can't show in github

I use markdown to write note, and when I want to add a picture, I do this:

![Alt desc](/home/user_name/repo_name/pic/pic_name "desc")

here comes a problem, when I git push the repo, the github coouldn't recognize the

absolute path in my computer

so my question is that what the picture path is in github and markdown file?

iverson
  • 853
  • 2
  • 10
  • 14

2 Answers2

33

You're expected to use an absolute path to a http accessible image

  • ![Alt desc](http://www.example.com/image.png)

If you're willing to link against your own repository, you should use the raw url format.

For instance, the following markdown

  • ![logo](https://github.com/libgit2/libgit2sharp/raw/master/square-logo.png)

should display the following image

logo

Note: An alternate raw format is also supported. The image above can also be accessed through the following url: https://raw.github.com/libgit2/libgit2sharp/master/square-logo.png

Update

Following your comment.

The following markdown in basic_option.md won't work.

  • > ![Alt vmware](https://github.com/liangxiao3/redhat_note/blob/master/pic/basic_vmware.jpg "vmware tool")

Switching it to the markdown below should fix this Indeed, you didn't use the raw url format (see above)

  • ![Alt vmware](https://github.com/liangxiao3/redhat_note/raw/master/pic/basic_vmware.jpg)
Community
  • 1
  • 1
nulltoken
  • 55,645
  • 19
  • 127
  • 125
  • what is the format of this path? In my github repository, my pictures are in pic directory, how could I refer to it ? – iverson Jun 07 '12 at 17:20
  • Could you share your github repository http url and point at the failing link? – nulltoken Jun 07 '12 at 20:02
  • here comes my github redhat_note repository , `git://github.com/liangxiao3/redhat_note.git`, and u can check `basic_option.md`, there is a picture which can't display regularly – iverson Jun 08 '12 at 01:09
5

You can just use relative path, like ![](pic/pic_name.png).

Gosha Arinich
  • 4,160
  • 1
  • 22
  • 31