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