Skip to main content

sanitize_git_url

Function sanitize_git_url 

Source
fn sanitize_git_url(url: &str) -> Option<String>
Expand description

Sanitizes a git remote URL by removing credentials and normalizing format.

§Security

This function strips any embedded credentials from URLs:

  • https://user:password@host/path -> host/path
  • git@host:org/repo.git -> host/org/repo

§Supported Formats

FormatExampleResult
HTTPShttps://github.com/org/repo.gitgithub.com/org/repo
HTTPS with credshttps://user:pass@github.com/org/repogithub.com/org/repo
SSHgit@github.com:org/repo.gitgithub.com/org/repo
Git protocolgit://github.com/org/repo.gitgithub.com/org/repo