Skip to main content

Home > git-documentdb > encodeToGitRemoteName

encodeToGitRemoteName() function#

encodeToGitRemoteName

Signature:
export declare function encodeToGitRemoteName(remoteURL: string): string;

Parameters#

ParameterTypeDescription
remoteURLstring
Returns:

string

Remarks#

The first default name of Git remote is "origin".

GitDocumentDB adds an alias of "origin", whose name is generated automatically by this function. The second and subsequent remotes are also named in the same way.

A remote name consists of [remote address]_[hash]. Periods are replaced with underscores. e.g.) github_com_a0b1c23 It is human-readable.

[remote address] is [hostname + domain name] or [ip address]. [hash] is calculated from remoteURL.

[hash] is the first seven characters of SHA-1 so that it may collide. Capitalize one of the remote addresses when hashes collide because a hostname and a domain name are not case sensitive.

Exceptions#

RemoteErr.InvalidURLFormatError