Get the name of the default remote: the one matching the repository field in package.json.
Throws if options.cwd is not in a git repo or there's no package.json at the repo root.
The order of preference for returned remotes is:
If repository is defined in package.json, the remote with a matching URL (if options.strict
is true, throws an error if no matching remote exists)
upstream if defined
origin if defined
The first defined remote
If there are no defined remotes: throws an error if options.strict is true; otherwise returns origin
Get the name of the default remote: the one matching the
repository
field in package.json. Throws ifoptions.cwd
is not in a git repo or there's no package.json at the repo root.The order of preference for returned remotes is:
repository
is defined in package.json, the remote with a matching URL (ifoptions.strict
is true, throws an error if no matching remote exists)upstream
if definedorigin
if definedoptions.strict
is true; otherwise returnsorigin