copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Copy/Paste broken in Copilot CLI when using SSH inside a tmux session on macOS/Linux → Windows Server 2025

Open kzh125 opened this issue 6 months ago • 9 comments

Describe the bug

After upgrading to Copilot CLI v1.0.47, copy/paste no longer works when accessing Copilot CLI on a remote Windows Server 2025 machine via SSH from inside a tmux session.

Affected version

v1.0.47

Steps to reproduce the behavior

Scenario Copy/Paste
Open Copilot CLI directly on macOS/Linux ✅ Works
SSH into Windows Server, open Copilot CLI ✅ Works
Open tmux session → SSH into Windows Server → open Copilot CLI ❌ Broken

Other CLI tools (Codex CLI, Gemini CLI) handle copy/paste correctly in all three scenarios.

tmux Configuration

set -g prefix C-a
unbind C-b

bind C-a send-prefix
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %

set -g mouse on
set -g history-limit 50000
set -g allow-passthrough on

set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm*:RGB"

bind r source-file ~/.tmux.conf \; display "Reloaded!"

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

set -g @plugin 'egel/tmux-gruvbox'
set -g @tmux-gruvbox 'light'
set -g @tmux-gruvbox-statusbar-alpha 'true'

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'

run '~/.tmux/plugins/tpm/tpm'

set -g status-right ''

Expected behavior

Copy/paste should work consistently regardless of whether the terminal is running inside a tmux session.

Additional context

The set -g allow-passthrough on option is already set in the tmux config, which is typically required for OSC52 clipboard passthrough. This suggests Copilot CLI may be using a different clipboard mechanism that does not survive the tmux → SSH chain.

kzh125 avatar May 12 '26 14:05 kzh125

Hey @kzh125, thank you for reporting this issue. What version of Tmux are you using? What happens when you use the set -g set-clipboard on option in your config?

aymanbagabas avatar May 13 '26 19:05 aymanbagabas

@aymanbagabas I'm running the latest version of tmux (v3.6a).

Previously, I had not set set -g set-clipboard on in .tmux.conf, meaning I was relying on the default tmux behavior, which should work in most cases.

I've since tried explicitly setting set -g set-clipboard on, but copying from copilot-cli still doesn't work — this option made no difference.

kzh125 avatar May 13 '26 23:05 kzh125

By the way, after I select text in the terminal, copilot-cli seems to get stuck and I can't deselect anything.

kzh125 avatar May 13 '26 23:05 kzh125

Image

now using copilot v1.0.47

kzh125 avatar May 13 '26 23:05 kzh125

By the way, after using Ctrl+C in the Copilot CLI, my previous messages disappeared. I can't copy them unless I restore the session, which is a poor user experience. Both Codex and the Gemini CLI keep the conversation history after a Ctrl+C interrupt.

kzh125 avatar May 15 '26 11:05 kzh125

Workaround but not a fix on Windows:

Hold down the Shift key on your keyboard. While holding Shift, use your mouse to highlight the code inside the Copilot window. Press Ctrl + Shift + C to copy it directly to your Windows clipboard.

This bypasses the CLI copy overwrite.

MichaelBalazs avatar Jun 04 '26 11:06 MichaelBalazs

I'm also running in to this issue on macos 26.6.2 in Copilot CLI version 1.0.84-3

For me the workaround was to run copilot --no-mouse

mokshadharma avatar Sep 10 '26 13:09 mokshadharma

13. I'm also running in to this issue on macos 26.6.2 in Copilot CLI version 1.0.84-3 For me the workaround was to run copilot --no-mouse

This gets copy to work, but now mouse scroll is broken so not a great work around. (using iterm from mac os connecting to a linux box box over ssh and using tmux).

bradrlaw avatar Oct 27 '26 02:10 bradrlaw

Copy should work when mouse is on if you select and right click. Most terminals require a key modifier to pass a right click to the running app. For example, iTerm2 on requires shift+rightclick

aymanbagabas avatar Oct 27 '26 15:10 aymanbagabas