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
repositoryfield in package.json. Throws ifoptions.cwdis not in a git repo or there's no package.json at the repo root.The order of preference for returned remotes is:
repositoryis defined in package.json, the remote with a matching URL (ifoptions.strictis true, throws an error if no matching remote exists)upstreamif definedoriginif definedoptions.strictis true; otherwise returnsorigin