From 8e4c6797238d9b2772a947e324bf340c256f86ea Mon Sep 17 00:00:00 2001 From: Chris Biscardi Date: Wed, 22 Apr 2026 11:15:22 -0700 Subject: [PATCH] Handle git push when there is no remote (#54522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously hitting `Publish` in the git panel would silently fail with no error message if the git repo was new or didn't have a remote. Now, when hitting `Publish` or attempting to push when there is no remote using keyboard shortcuts, or using `Push To` or force push options, an error message will be displayed. Screenshot 2026-04-22 at 10 02
26 AM Screenshot 2026-04-22 at 10 02
36 AM Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed handling of `git push` when there is no remote available to push to --- crates/git_ui/src/git_panel.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 1f9f08f47f09efaac8f35c2832f37002ec83185d..23d9c728c058f1b4fb1aef1146089a73c3f0bb1f 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -3109,6 +3109,14 @@ impl GitPanel { let remote = match remote.await { Ok(Some(remote)) => remote, Ok(None) => { + this.update(cx, |this, cx| { + this.show_error_toast( + "push", + anyhow::anyhow!("No remote available to push to. Add a remote to be able to publish changes."), + cx, + ) + }) + .ok(); return Ok(()); } Err(e) => {