سؤال

I'm trying to embed an image in my readme.md for display on GitHub. I've had no trouble doing this before with public repositories, in this format:

![header image](https://raw.github.com/account/reponame/master/myimage.png)

I'm now doing the same for a private repo that lives under an organization account and getting a 404. If I navigate to the image in the repo and get the raw URL, I get something like:

https://raw.github.com/account/reponame/master/myimage.png?login=jackaperkins&token=b295d913f6bf6e5cf1115755fb05e770

Is there a way to tell GitHub to embed the real authenticated URL? I figured the access to the resource would be controlled with sessions outside of the URL but apparently not.

هل كانت مفيدة؟

المحلول

You need a token if you use the raw paths. Assuming that the image file is in the same repository, you can do it like this:

![Image](../blob/master/myimage.png?raw=true)

More on github blog

نصائح أخرى

I came here through Google, trying to figure out how to embed figures, lying in a private repo inside the wiki of this private repo (so not the Readme.md). I also had the problem that raw links with the tokens didn't work for me.

The only thing that worked for me, where absolute links to the figures in the private repo, e.g.:

![header image](https://github.com/account/reponame/blob/master/myimage.png)

So directly link to the figure in the repo, not using the raw URL. Also, no need to use ?raw=true as suffix.

Need to use raw url with token then you can access from private repo

https://github.com/account/reponame/blob/master/myimage.png?raw=true if you run this url it will redirects based on repo.

if its public repo it changes to https://raw.githubusercontent.com/account/reponame/master/myimage.png

if its private repo it changes to https://raw.githubusercontent.com/account/reponame/master/myimage.png?token=XXXXXXXXXXXXXXXXXX

For accessing private repo image you have to use with token

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top