# Cursor Agent repeatedly spawns hundreds of external Git Bash/MSYS2 terminals on Windows

**URL:** <https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912>\
**Category:** Bug Reports\
**Tags:** auto-run, plugins, terminal, windows\
**Created:** [June 23, 2026, 7:38pm UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912 "2026-06-23T19:38:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sorin\_Tamas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/sorin_tamas/32/112438_2.png) [@Sorin\_Tamas](https://forum.cursor.com/u/Sorin_Tamas)\
**Post date:** [June 23, 2026, 7:38pm UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/1 "2026-06-23T19:38:36Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

Cursor on Windows repeatedly spawns hundreds of external Git Bash/MSYS2 windows while Agent is generating code.

Each window title is:  
/usr/bin/bash --login -i C:\Users\Sorin.cursor\plugins\cache\cursor-public\deploy-on-a…

Normal terminal profile is set to PowerShell, but Cursor still launches external bash windows from .cursor\plugins\cache\cursor-public. Terminal: Kill All Terminals does not close them because they are external Windows processes, not integrated terminal tabs.

### Steps to Reproduce

1. Open project in Cursor on Windows.
2. Ask Cursor Agent to generate or modify code.
3. Cursor starts opening external Git Bash/MSYS2 windows.
4. The number of windows keeps increasing.
5. Cursor becomes unusable.

### Expected Behavior

Cursor should run commands in one controlled integrated terminal, or ask for approval before running commands. It should not spawn external Bash windows repeatedly.

### Screenshots / Screen Recordings

 ![bug.png](https://us1.discourse-cdn.com/cursor1/original/3X/e/7/e7074ac6a223e51287696fc24c0fedb267f651f5.jpeg)

### Operating System

Windows 10/11

### Version Information

Version: 3.8.22 (user setup)  
VS Code Extension API: 1.105.1  
Commit: 46fb7aafe279d7c72346febe68c2e004b7d1de60  
Date: 2026-06-22T21:41:16.291Z  
Layout: editor  
Build Type: Stable  
Release Track: Default  
Electron: 40.10.3  
Chromium: 144.0.7559.236  
Node.js: 24.15.0  
V8: 14.4.258.32-electron.0  
xterm.js: 6.1.0-beta.256  
OS: Windows\_NT x64 10.0.19045

### Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [June 24, 2026, 5:27am UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/5 "2026-06-24T05:27:58Z")

</div>

Hey, thanks for the detailed report. I can see the screenshot with dozens of Git Bash windows, all with the same title from `.cursor\plugins\cache\cursor-public\deploy-on-a...` and that’s the source.

What’s happening: one of the plugins (`cursor-public`, `deploy-on-a...`) registers a hook on every file edit (afterFileEdit), and the hook command points to a `.sh` script. On Windows, a raw `.sh` path doesn’t go through Cursor’s bundled shell, it goes through the system file association. Since you have Git for Windows installed, `.sh` is associated with `bash --login -i "%1"`, so every hook run opens a new external Git Bash window. The hook triggers on every edit, so during generation you end up with hundreds. The terminal profile (PowerShell) doesn’t matter here, and Kill All Terminals won’t close them because they’re external processes.

How to fix it right now:

- Open Cursor Settings \> Hooks and check the list of registered hooks. You’ll see a hook from `cursor-public` or `deploy-on-a...` pointing to a `.sh`.
- Fastest option is to disable that plugin. The per-edit hook will stop firing and the windows will stop.
- If you need the plugin, wrap the hook in bash or use a thin `.ps1` wrapper instead of calling the raw `.sh`. A ready PowerShell wrapper recipe is in this thread [Windows "Select an app to open" dialog triggers when opening AI chat (.sh file handler issue)](https://forum.cursor.com/t/windows-select-an-app-to-open-dialog-triggers-when-opening-ai-chat-sh-file-handler-issue/155428) (post by @Emrah), and the general guide is here [Hooks in Windows](https://forum.cursor.com/t/hooks-in-windows/150377).

We know about this mechanism (hooks calling `.sh` via the OS file handler on Windows). I’ve reported your case with the external windows internally. I can’t share a timeline for a fix yet. Let me know which plugin was the culprit and whether the steps above helped.

---

<div class="post-metadata">

**Author:** ![Sorin\_Tamas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/sorin_tamas/32/112438_2.png) [@Sorin\_Tamas](https://forum.cursor.com/u/Sorin_Tamas)\
**Post date:** [June 26, 2026, 9:07am UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/8 "2026-06-26T09:07:45Z")

</div>

Hey Dean,

Thanks for the reply!

I checked the Hooks menu and I found only a single one defined, that is unrelated to my situation. I attach a screenshot with it. This hook is not used when I ask the agent to generate some code, because my issue is happening even in new projects, that doesn’t have AWS integrated in any way

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/8/b/8b826cb624a9acdceb5034760c2b17f59aaf1f30.png)

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [June 26, 2026, 9:26am UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/9 "2026-06-26T09:26:49Z")

</div>

Thanks for the screenshot, it shows the source of the issue. The `deploy-on-aws config` hook type `postToolUse`, path `.cursor\plugins\cache\cursor-public\deploy-on-aws\...`, is the one.

The confusing part is that even though it’s called “deploy-on-aws”, this hook isn’t tied to AWS in your project. `postToolUse` runs after every agent tool call, meaning after every file edit, no matter if the project uses AWS or not. That’s why it also triggers in new projects. And the path shown in the title of the external Git Bash windows from your first report `...\cursor-public\deploy-on-a...` matches this hook exactly.

What to do now:

- Disable or uninstall the `cursor-public` / `deploy-on-aws` plugin. The hook will stop running and the external windows should stop.
- If you need the plugin, wrap the hook in bash or use a thin `.ps1` wrapper instead of calling the raw `.sh`. Recipe: [Windows "Select an app to open" dialog triggers when opening AI chat (.sh file handler issue)](https://forum.cursor.com/t/windows-select-an-app-to-open-dialog-triggers-when-opening-ai-chat-sh-file-handler-issue/155428) post by @Emrah. General guide: [Hooks in Windows](https://forum.cursor.com/t/hooks-in-windows/150377).

We’ve already reported the underlying issue on our side, the hook calling a `.sh` ends up going through Windows file associations. I can’t share an ETA for a fix yet. Let me know if the windows stop after you disable the plugin.

---

<div class="post-metadata">

**Author:** ![Sorin\_Tamas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/sorin_tamas/32/112438_2.png) [@Sorin\_Tamas](https://forum.cursor.com/u/Sorin_Tamas)\
**Post date:** [June 29, 2026, 1:51pm UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/10 "2026-06-29T13:51:29Z")

</div>

Sorry for the late reply.

I tried it out as you said and I can confirm the issue is gone if I disable the plugin.

Thanks for your patience!

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [July 1, 2026, 1:52pm UTC](https://forum.cursor.com/t/cursor-agent-repeatedly-spawns-hundreds-of-external-git-bash-msys2-terminals-on-windows/163912/11 "2026-07-01T13:52:11Z")

</div>

Closed on July 1, 2026, 1:52pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
