Skip to content
OddsockLocal
Local
Source text

Formatting

1 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Paste a github.com repository, tree or blob URL, or a git@github.com SSH URL.
  2. If the branch name contains a slash, type that full name in Branch override.
  3. Read owner, repo, branch and path.
  4. Copy clone, ssh, zip or raw. Nothing is fetched from GitHub.

What is GitHub URL parser?

A GitHub URL mixes the branch and the path in one trail of segments, and a branch named feature/work makes the split ambiguous. Paste https://github.com/acme/demo/blob/feature/work/a.ts and set Branch override to feature/work. The page returns owner acme, repo demo, branch feature/work, path a.ts, the https clone URL, the git@github.com SSH URL, a zip of refs/heads/feature/work, and the raw.githubusercontent.com link for that file.

Read more

The override is required only when the branch itself contains a slash. Without it, the first segment after blob or tree would be taken as the whole branch, and work/a.ts would be misread as the path. For a branch with no slash you can leave the override empty. Repository URLs with no blob or tree come back with branch, path and raw set to null, and the zip points at HEAD.

Only github.com is accepted, including the git@github.com:owner/repo.git spelling, which is rewritten to https before parsing. The page does not look the branch up on the network. If the override does not match a prefix of the URL, that is an error. Other hosts are rejected.

Use cases

  • A blob URL uses a branch named feature/work and you need the raw file link without guessing where the branch ends.
  • A script wants clone, SSH and zip URLs derived from one browser URL a teammate pasted.
  • You need to confirm a link is github.com before you treat the first two path segments as owner and repo.
  • A zip of a branch should use refs/heads/ rather than a shortened name that fails when the branch contains a slash.

A blob URL whose branch contains a slash

https://github.com/acme/demo/blob/feature/work/a.ts with branch override feature/work.

owner acme, repo demo, branch feature/work, path a.ts, clone https://github.com/acme/demo.git, ssh git@github.com:acme/demo.git, zip https://github.com/acme/demo/archive/refs/heads/feature/work.zip, raw https://raw.githubusercontent.com/acme/demo/feature/work/a.ts.

Why use Oddsock

The override exists because the URL does not say where the branch stops. Guessing would hand you the wrong raw link.

Related tools

Using this tool

blob/feature/work/a.ts can be read as branch feature and path work/a.ts, or branch feature/work and path a.ts. The override picks the second reading. The page will not call the GitHub API to find out.