Add a new remote. # Arguments `name` - The name for the new remote `url` - The URL of the remote repository # Errors Returns an error if: - A remote with the same name already exists - The name is invalid - The URL is invalid # Example ```rust,ignore let repo = Repository::open(".")?; repo.add_remote("origin", "https://api.example.com/repo")?; ```
(&self, name: &str, url: &str)
| 110 | /// repo.add_remote("origin", "https://api.example.com/repo")?; |
| 111 | /// ``` |
| 112 | pub fn add_remote(&self, name: &str, url: &str) -> Result<(), RepositoryError> { |
| 113 | let mut config = self.load_remotes()?; |
| 114 | config |
| 115 | .add(name, RemoteEntry::new(url)) |
| 116 | .map_err(RepositoryError::Remote)?; |
| 117 | self.save_remotes(&config) |
| 118 | } |
| 119 | |
| 120 | /// Add a new remote and set it as the default. |
| 121 | /// |
nothing calls this directly
no test coverage detected