I want to delete a branch locally and remote. My code:
using (var repository = new Repository(path)) { var remote = repository.Network.Remotes[\"origin\
This is failing with a 401 Unauthorized error because it is unauthorized. To fix this error, you just need to pass the options containing your credentials to the Push() method:
options
Push()
repository.Network.Push(remote, pushRefSpec, options)
That fixed this problem for me.