git: include a hint about possible permission error when push fails

When the remote rejects a push, we now say something like this:

```
Remote rejected the update of some refs (do you have permission to push to ["refs/heads/main"]?)
```

That message could be formatted better, but this seems good enough for
now. We should probably have some more custom conversion from
`GitPushError` to `CommandError` in the CLI layer.
This commit is contained in:
Martin von Zweigbergk 2022-09-26 08:42:41 -07:00 committed by Martin von Zweigbergk
parent d1565fb6eb
commit 5e539771c5

View file

@ -319,7 +319,7 @@ pub enum GitPushError {
NoSuchRemote(String),
#[error("Push is not fast-forwardable")]
NotFastForward,
#[error("Remote reject the update of some refs")]
#[error("Remote rejected the update of some refs (do you have permission to push to {0:?}?)")]
RefUpdateRejected(Vec<String>),
// TODO: I'm sure there are other errors possible, such as transport-level errors,
// and errors caused by the remote rejecting the push.