MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add_remote

Method add_remote

atomic-repository/src/repository/remotes.rs:112–118  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 3

load_remotesMethod · 0.80
save_remotesMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected