git-url-parse - Man Page

Parse and extract git URL components

Synopsis

git url-parse [-c <component>] [--] <url>​...

Description

Git supports many ways to specify URLs, some of them non-standard​. For example, git supports the scp style [user@]host:[path] format​. This command eases interoperability with git URLs by enabling the parsing and extraction of the components of all git URLs​.

Any syntactically valid URL is parsed, even if the scheme is not one git supports for fetching or pushing​.

Options

-c <component>, --component <component>

Extract the <component> component from the given Git URLs​. <component> can be one of: scheme, user, password, host, port, path​.

Output

When --component is given, the requested component of each URL is printed on its own line, in the order the URLs were given​. If the URL has no such component (for example, a port in a URL that does not specify one), an empty line is printed in its place​.

When --component is not given, no output is produced​. The exit status is zero if every URL parses successfully and non-zero otherwise, allowing the command to be used purely as a validator​.

Examples

See Also

git-clone(1), git-fetch(1), git-config(1)

Git

Part of the git(1) suite

Info

09/28/2026 Git 2.56.0 Git Manual