Skip to main content

Module endpoint

Module endpoint 

Source
Expand description

Resolve the LFS server endpoint for a repo.

Implements the priority chain documented in docs/api/server-discovery.md, plus the SSH/git URL → HTTPS rewriting upstream does so a git@github.com:foo/bar.git remote yields the expected https://github.com/foo/bar.git/info/lfs endpoint.

§Priority order

  1. GIT_LFS_URL environment variable (matches upstream’s escape hatch).
  2. lfs.url from git config — local → global → system → .lfsconfig.
  3. remote.<name>.lfsurl (same scopes as above).
  4. remote.<name>.url rewritten via derive_lfs_url.

<name> defaults to origin when the caller hasn’t passed a remote.

§SSH-style URLs

git lfs itself only speaks HTTP(S); for SSH remotes the protocol is still HTTPS, just inferred from the remote’s host/path. Upstream also supports the git-lfs-authenticate SSH command for handing back a token; that’s deferred (see NOTES.md).

Enums§

EndpointError

Functions§

derive_lfs_url
Convert a clone URL into the matching LFS endpoint URL.
endpoint_for_remote
Resolve the LFS endpoint URL for cwd + remote. Pass None for the default (origin, with a “single remote” fallback when origin doesn’t exist and exactly one other remote does).