Images Videos Audio Pricing Docs View as Markdown (Agent) Get started
Human Agent
← Back to blog

private-user-images.githubusercontent.com broken? Here's why, and how to fix it

You copied an image link out of a private GitHub repo, and now it says "This private-user-images.githubusercontent.com page can't be found." The image isn't gone. The link was never meant to last.

What this URL is

When you paste or drag an image into an issue, pull request, discussion or README in a private repository, GitHub stores it as an attachment. The Markdown you see in the editor points at github.com/user-attachments/assets/… (older uploads used user-images.githubusercontent.com).

Since 2023, GitHub only shows private-repo attachments to people who are logged in and can see the repo. To do that, every time it renders the page it swaps the link for a signed one on private-user-images.githubusercontent.com, with a token on the end: …/12345678/…png?jwt=eyJ….

That token expires fast. GitHub doesn't document the lifetime, but people who have decoded it report about five minutes. Inside github.com you never notice, because every page view gets a fresh token. Anywhere else, the link dies a few minutes after you copied it.

Why it says "page can't be found"

Once the token has expired, the URL returns a 404, whatever the state of the image. You see this when the signed link ended up somewhere that keeps it:

  • You right-clicked "Copy image address" and pasted it into Slack, a doc, a ticket or a wiki.
  • A tool cached the rendered HTML: a docs site, a blog built from GitHub issues or discussions, an RSS reader, a search index, an LLM pipeline.
  • You moved the content out of GitHub (to GitLab, Jira, Linear, Notion or a static site) and the migration copied rendered image URLs instead of the files.
  • The viewer isn't logged in, or isn't a member of the repo. The original user-attachments link won't work for them either: it only resolves for people with access.

The last case also explains a related surprise: making a repo public, or moving content out of a private one, doesn't make its attachments portable. They stay tied to GitHub's access check.

Is the image lost?

No. The file is still attached to the issue, PR or README it was uploaded to. What you have is an expired pass to it. The fix is always the same: get a fresh signed URL from GitHub, then store the image somewhere that doesn't expire before that new URL does.

Fix 1: one image, by hand

  1. Open the issue, PR or README on github.com while logged in.
  2. Right-click the image and choose Save image as… (saving the file, not copying its address).
  3. Upload the file somewhere that gives you a link without a token, for example the free image to URL tool, and use that link instead. Links from the free tool last 24 hours; press "Keep this image" and save it to a free account to remove that fixed expiry. Free-plan retention applies.

Fix 2: every image in an issue or PR

The GitHub API can return an issue's body_html, rendered the same way the website does, which means with freshly signed image URLs in it. Pass each one to PixelVault right away and it fetches the bytes server-side while the token is still valid. You get back a permanent img.pixelvault.dev URL per image:

Before you run it: these images came from a private repo, and the new URLs are public: anyone who has a link can open the image, no GitHub login needed. That is what makes them work in docs, feeds and other tools, but it is a change in who can see them. Only re-host screenshots you are fine sharing that way, and leave anything confidential (customer data, credentials, internal dashboards) on GitHub.

# Re-host every private attachment in one issue or PR: the body, comments, # and (for a PR) review bodies and inline review comments. # Needs: gh (logged in, with access to the repo), jq, curl and a # PixelVault API key. REPO="your-org/your-private-repo" NUMBER=42 ISSUE="repos/$REPO/issues/$NUMBER" PULL="repos/$REPO/pulls/$NUMBER" RESULT='.data.url // ("ERROR: " + (.error.message // "unknown"))' # GitHub's rendered HTML carries freshly signed image URLs. rendered() { gh api -H "Accept: application/vnd.github.html+json" "$@"; } { rendered "$ISSUE" --jq '.body_html' rendered "$ISSUE/comments" --paginate --jq '.[].body_html' # These two only exist for pull requests; on an issue they 404, fine. rendered "$PULL/reviews" --paginate --jq '.[].body_html' 2>/dev/null rendered "$PULL/comments" --paginate --jq '.[].body_html' 2>/dev/null } | grep -oE 'https://private-user-images\.githubusercontent\.com/[^"]+' \ | sed 's/&/\&/g' | uniq \ | while read -r signed; do # The signed URL is only valid for a few minutes, so hand it to # PixelVault straight away: it fetches the bytes server-side. new=$(curl -sS -X POST https://api.pixelvault.dev/v1/images \ -H "Authorization: Bearer $PIXELVAULT_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg url "$signed" \ '{url: $url, folder: "github", dedupe: true}')" \ | jq -r "$RESULT" 2>/dev/null) # Old file (token stripped) -> new permanent URL, one line per image. echo "${signed%%\?*} -> ${new:-ERROR: no response}" done

A few notes so it doesn't surprise you:

  • Each line pairs the original file (with its token stripped) with its new URL, so you can tell which image is which when you replace the github.com/user-attachments/assets/… links in the Markdown source. Open an old one in your browser on GitHub if you need to see it.
  • A line that says ERROR didn't re-host (most often a token that expired before the call, or an image over your plan's size cap, 5 MB on the free plan). Run the script again for that issue; already re-hosted images come back with the same URL.
  • Run it in one go. If you collect the signed URLs and come back later, they will have expired again.
  • dedupe: true makes a re-run safe: the same image comes back with the same URL instead of a second copy.
  • Each image can be up to 5 MB on the free plan, and URL import needs an API key (a free account has one).

For a README, ask for the rendered HTML instead:

# Same idea for a README: ask GitHub for the rendered HTML. gh api "repos/$REPO/readme" -H "Accept: application/vnd.github.html" \ | grep -oE 'https://private-user-images\.githubusercontent\.com/[^"]+'

That only finds images that were dragged into GitHub's editor. Images committed to the repo and referenced by a relative path (docs/screenshot.png) are ordinary files: upload them straight from your checkout instead, for example with the script in the Confluence post, which re-hosts every local image a Markdown file points at.

If you are migrating a whole repo's issues to another tracker, run the same step for each issue before the import, and rewrite the image links in the exported Markdown. Most importers copy whatever URL is in the body, and for private attachments that URL stops working as soon as it leaves GitHub.

Stop it happening again

Attachments are fine for screenshots that only ever live in that one issue. For anything that gets embedded elsewhere (a README that also renders on npm, docs, a status page, a newsletter), host the image on a URL you control and reference that from the Markdown. A link with no token on it works for logged-out readers, in feed readers and for agents reading your docs. Hosting images for a GitHub README covers the setup, including the other two ways GitHub images break.

Got a broken link right now? Re-download the image from GitHub, then turn it into a link with the image to URL tool. No signup needed to try it; save it to a free account to keep it.

Quick reference

  • …githubusercontent.com/…?jwt=… 404s: the token expired. Get a fresh one by opening the page on GitHub while logged in.
  • github.com/user-attachments/assets/… 404s: the viewer is logged out or has no access to the repo.
  • A whole issue or PR full of them: Fix 2 above.
  • Moving docs or issues off GitHub: re-host the images first, then import.
  • Images from other expiring sources: Notion, Discord and Confluence exports break the same way.