Skip to main content

get_remote_url

Function get_remote_url 

Source
pub fn get_remote_url(remote_name: Option<&str>) -> Result<String>
Expand description

Returns the remote URL for the specified remote.

§Arguments

  • remote_name - The name of the remote (e.g., “origin”, “upstream”). Defaults to “origin” if None.

§Errors

Returns an error if the specified remote does not exist or if the URL cannot be retrieved.

§Examples

use rusty_commit::git;

// Get URL for "origin" remote (default)
let url = git::get_remote_url(None).unwrap();

// Get URL for "upstream" remote
let url = git::get_remote_url(Some("upstream")).unwrap();
println!("Remote URL: {}", url);