Updated October 27, 2026 · Maintained by huanglizhuo

Count lines of code without cloning the repository

You can count a GitHub repository's lines of code without cloning it: paste the URL into the OctoCounts web app and it downloads the source archive of the requested ref — not the git history — counts it with tokei, and returns files, total lines, code lines, comments, blanks, and per-language totals. Duration depends on repository size, upstream access, queueing, and deployment limits. The browser extension, report pages, .md twins, badges, and API all answer from the same archive-based pipeline, so no step ever requires a local clone.

Why avoid cloning just to count lines?

A full clone includes repository history as well as the current source tree. A source archive contains one revision without that history, which is enough for a line count. Transfer size and duration depend on the repository and network; shallow or partial clones can also reduce transfers. With OctoCounts, archive download and counting happen on the server.

How do I count lines without cloning?

  1. Open the OctoCounts web app and paste the repository URL — for example https://github.com/react/react.
  2. Optionally pick a branch, tag, or commit SHA. The analysis pins to the exact commit it resolves.
  3. OctoCounts downloads the source archive for that ref, runs tokei, and shows files, total lines, code, comments, blanks, and per-language rows.
  4. Share the report URL, export text/JSON/PNG, or add a live badge to your README.

If you keep reading code on github.com, the OctoCounts extension skips even the paste: it adds a SLOC card to the repository sidebar on every public repo page you visit.

Do git partial clones make no-clone counting unnecessary?

They narrow the gap without closing it. git clone --depth 1 truncates history but still fetches every file of the latest commit, and --filter=blob:none defers file contents until checkout — at which point running wc, cloc, or tokei fetches the whole tree anyway. A shallow partial clone of a monorepo can still be hundreds of megabytes on your disk. There are also read-only tricks that avoid git entirely — the GitHub API page explains why the API route still cannot give you lines — server-side archive counting is one way to avoid moving the source tree onto your machine.

Do the numbers match a count on a local clone?

Matching counts require the same actual source tree, tokei version, and effective counting rules, including extraction exclusions and repository attributes. A local checkout at the same commit may differ from an archive: export-ignore can omit paths and export-subst can change file contents. Record the full commit SHA, engine version, options, effective policy, and measurement date; retain the exported JSON and a saved-report link while available. Older reports may lack a complete policy. The filtering pilot measures option effects, not local-versus-server parity. See Git archive attribute semantics.

What is the fastest way to count lines without cloning?

For a one-off, open https://octocounts.com/github/:owner/:repo directly — a warm report can reuse cached counts because results are cached by repository, commit SHA, tokei version, and analysis options. For automation, the API's GET /api/reports/:reportId returns full JSON and the badge endpoints return a ready-made SVG. For scale: in OctoCounts' 2026 pilot, archive-based analysis of the react and vite repositories completed in 1.2–1.9 seconds of observed wall time per request; cache and queue state were not controlled.

When do you still need a clone?

Private repositories — OctoCounts analyzes public github.com repositories only and does not accept uploads — and any analysis that needs local tooling beyond line counts. In those cases clone (shallow if you like) and run tokei or cloc in the checkout; the full counting guide covers the clone-based commands too.

How can I verify a count without keeping a clone?

Export the report JSON and retain its full commit SHA, tokei version, generatedAt, selected options and effective countingPolicy. The ten-repository study archives complete reports rather than relying on a live cache. It measures filtering effects on GitHub source archives; it does not establish parity with a local checkout, and request wall time is not a cold-download benchmark.

Read the October 27, 2026 study and download its raw reports.