Pasted a link like github.com/owner/repo/blob/refs/heads/main/file.md and the macro is broken
What you are seeing
I pasted a link like github.com/owner/repo/blob/refs/heads/main/file.md and the macro is broken.
#Why it happens
When a pasted link is converted to a macro automatically, the third part of the link is read as the branch name without any checking. With a link containing refs/heads, the branch is read as "refs" and the file path as "heads/main/file.md", so the macro looks for a file that does not exist.
Browse GitHub reads this form of link correctly. Automatic conversion does not.
#What to do
Paste the short form of the link instead, for example github.com/owner/repo/blob/main/file.md. Or fix the existing macro by picking the file again through Browse GitHub.
#Settings involved
None. GitHub has no settings screen of its own, so there is nothing to change in Capable global settings or space settings.
#Limits that apply here
Limit | What happens |
|---|---|
Only two kinds of link convert | Only github.com blob links and raw.githubusercontent.com links convert. Directory (tree) links, gists and GitHub Enterprise links do not. |
Files are fetched on every view | Every time a page is viewed, each GitHub file macro fetches its file again. A page with many GitHub macros uses more of your GitHub API allowance on every view. |
#Related
Found it? Good.
