How can we change the remote url of a repository?
using (var repository = new Repository(repositoryPath))
{
//Change the remote url first
//Then checkout
}
How can we change the remote url of a repository?
var newUrl = "https://github.com/owner/my_repository.git";";
Remote remote = repo.Network.Remotes[name];
// This will update the remote configuration, persist it
// and return a new instance of the updated remote
Remote updatedremote = repo.Network.Remotes.Update(remote, r => r.Url = newUrl);
For what it's worth, most of the remote properties can be updated by following the same pattern. Feel free to take a peek at the RemoteFixture.cs test suite for more detailed examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With