GIT-URL-PARSE(1)
β¨ GIT-URL-PARSE(1) β¨
okay bestie so this is a page from the git manual and it's literally about git-url-parse, which is the tool you're gonna be obsessed with once you see what it does π
πΈ NAME πΈ
git-url-parse β parse and extract git URL components π
π¦ SYNOPSIS π¦
git url-parse [-c <component>] [--] <url>...
π DESCRIPTION π
So git supports so many ways to write a URL, and ngl some of them are kinda non-standard π. Like, git straight up supports the scp style [user@]host:[path] format β yes, that whole vibe. This command exists so interoperability with git URLs isn't a whole ordeal: it lets you parse and extract the components of, fr fr, all git URLs π«Ά
And here's the tea: any syntactically valid URL gets parsed, even if the scheme is not one git actually supports for fetching or pushing. So it's not doing a vibe check on whether git would use it β it's just parsing it. periodt π
β OPTIONS β
-c <component>,--component <component>β extract the<component>component from the given Git URLs, bestie.<component>can be one of:scheme,user,password,host,port,path. that's the whole list, no cap π―
π₯ OUTPUT π₯
When --component is given, the requested component of each URL gets printed on its own line, in the order the URLs were given π§
And if the URL has no such component β like, imagine asking for a port on a URL that does not specify one β an empty line is printed in its place. not an error, just a lil blank line. slay π
When --component is not given, no output is produced at all. The exit status is zero if every URL parses successfully and non-zero otherwise β so you can use the command purely as a validator. it's giving "quiet luxury" honestly π
π EXAMPLES π
Print the host name:
$ git url-parse --component host https://example.com/user/repo
example.com
Print the path:
$ git url-parse --component path https://example.com/user/repo
/user/repo
$ git url-parse --component path example.com:~user/repo
~user/repo
$ git url-parse --component path example.com:user/repo
/user/repo
Validate URLs without outputting anything:
$ git url-parse https://example.com/user/repo example.com:~user/repo
π SEE ALSO π
git-clone(1), git-fetch(1), git-config(1) β go read those too, iykyk π
π GIT π
Part of the git(1) suite π«
lowkey the most important thing here: this page is out here doing the most so you don't have to. go parse some URLs, bestie π¦
that's a wrap! this page is from Git 2.56.0, dated 2026-09-27 β mwah, bye! ππ
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms