Skip to main content

get_git_remote_url

Function get_git_remote_url 

Source
pub fn get_git_remote_url<P: AsRef<Path>>(cwd: P) -> String
Expand description

Returns the origin remote URL for the git repository at cwd.

Results are memoized in a process-global, thread-safe cache under both the original absolute path and its canonical path. This avoids repeated canonicalization while still letting symlinked variants share one lookup. The returned URL has any trailing .git stripped. Returns an empty String when cwd is empty, is not a git working tree, has no origin remote, or the config cannot be read. Callers treat the empty string as “no remote”.