GitHub URL Parser

Paste a GitHub link to a repository, file, folder, pull request, issue, commit or release and get its parts (owner, repository, branch, path, line numbers) and every link you might need next: the raw file, HTTPS and SSH clone URLs, a ZIP download, the API address and ready-to-run git and gh commands.

Repo, file, folder, raw, pull request, issue, commit, release or SSH clone URL. owner/repo works too.

Parts

TypeFile
Ownervercel
Repositorynext.js
owner/repovercel/next.js
Branch, tag or commitcanary
Pathpackages/next/package.json
File or folder namepackage.json
Lines1-10

Branch names can contain a slash (feature/login), so a URL alone cannot always show where the branch ends and the path begins. We read the first part as the branch. If your branch has a slash, move that part from the path to the branch.

Links and commands

Repositoryhttps://github.com/vercel/next.js
Clone (HTTPS)https://github.com/vercel/next.js.git
Clone (SSH)[email protected]:vercel/next.js.git
git clonegit clone https://github.com/vercel/next.js.git
GitHub CLIgh repo clone vercel/next.js
Clone this branch or taggit clone --branch canary --single-branch https://github.com/vercel/next.js.git
Download ZIPhttps://github.com/vercel/next.js/archive/refs/heads/canary.zip
Download tar.gzhttps://github.com/vercel/next.js/archive/canary.tar.gz
File on GitHubhttps://github.com/vercel/next.js/blob/canary/packages/next/package.json#L1-L10
Raw filehttps://raw.githubusercontent.com/vercel/next.js/canary/packages/next/package.json
File historyhttps://github.com/vercel/next.js/commits/canary/packages/next/package.json
Blamehttps://github.com/vercel/next.js/blame/canary/packages/next/package.json
API (contents)https://api.github.com/repos/vercel/next.js/contents/packages/next/package.json?ref=canary
curl downloadcurl -L -o package.json https://raw.githubusercontent.com/vercel/next.js/canary/packages/next/package.json
Releaseshttps://github.com/vercel/next.js/releases
API (repository)https://api.github.com/repos/vercel/next.js

Parsing runs in your browser. What you type never leaves this device.

Features

  • Understands github.com, raw.githubusercontent.com, api.github.com and [email protected] URLs, plus owner/repo shorthand

  • Raw file link from a normal file page, and the normal page from a raw link

  • Clone commands for HTTPS, SSH and the GitHub CLI, and one for a single branch or tag

  • ZIP and tar.gz download links for the branch or tag in the URL

  • Patch, diff and local checkout commands for pull requests and commits

  • Line ranges from #L10-L20 anchors are kept on the file link

Handy for

Downloading one file

Turn a file page into its raw URL to use with curl or wget in a script, a Dockerfile or a CI step, without cloning the whole repository.

Sharing a repo with a non-developer

Give them the ZIP download link for the right branch instead of explaining git.

Switching between HTTPS and SSH

Copy the SSH remote when your HTTPS push asks for a password, or the HTTPS URL when SSH is blocked on an office network.

Reviewing a pull request locally

Get the gh pr checkout or git fetch command for the PR number in the link.

Reading a GitHub URL

The common shapes

  • github.com/owner/repo: the repository home page.
  • github.com/owner/repo/blob/branch/path/file: one file at a branch, tag or commit.
  • github.com/owner/repo/tree/branch/path: a folder, or the whole repo at that branch.
  • raw.githubusercontent.com/owner/repo/branch/path/file: the file's bare contents.
  • [email protected]:owner/repo.git: the SSH address used by git.

When the branch has a slash

Branch names like feature/login also use slashes, so the URL alone cannot show where the branch name ends and the file path begins. The parser reads the first segment as the branch and tells you when the split could be different. GitHub itself resolves this by checking which branches exist.

Private repositories

The links are built from the URL text, so they look the same for private repositories, but opening them still needs access. Raw and ZIP links for private repos need you to be signed in, or a token when used from scripts.

GitHub URL Parser - FAQ