Skip to main content

parse_git_url

Function parse_git_url 

Source
pub fn parse_git_url(url: &str) -> (String, String, String)
Expand description

Parses a git URL to extract the server, account, and repository name.

§Arguments

  • url - The URL of the git repository to parse. Can be in HTTPS format (https://github.com/username/repo.git) or SSH format (git@github.com:username/repo.git).

§Returns

A tuple containing:

  • server - The server name (e.g., “github.com”)
  • account - The account or organization name (e.g., “username”)
  • repo - The repository name (e.g., “repo”)

If the URL cannot be parsed, all three values will be empty strings.