A gh CLI extension that forwards clipboard (copy/paste), open commands, and screenshot images from remote SSH sessions back to your local machine.
Stolen from BlakeWilliams/remote-development-manager and repackaged as a gh extension.
- A server runs on your local machine, listening on a unix socket.
- The socket is forwarded to remote machines via the SSH
-Rflag. - Client commands on the remote side send copy/paste/open requests back through the tunnel.
gh extension install maxbeizer/gh-rdmRun the interactive setup wizard to get everything configured:
gh rdm setupThis walks you through starting the server, configuring SSH forwarding in ~/.ssh/config, and setting up integrations (neovim, gh CLI browser, shell aliases).
Start the server and SSH into a remote host with clipboard forwarding in one shot:
gh rdm server & ssh -R 127.0.0.1:7391:$(gh rdm socket) user@remote-hostFor GitHub Codespaces:
gh rdm server & gh cs ssh -- -R 127.0.0.1:7391:$(gh rdm socket)# Start the server
gh rdm server
# Get socket path (useful for SSH config)
gh rdm socket
# Stop the server
gh rdm stopForward the local socket to the remote host so client commands can reach it:
ssh -R 127.0.0.1:7391:$(gh rdm socket) user@remote-host# Copy to local clipboard
echo "hello" | gh rdm copy
# Paste from local clipboard
gh rdm paste
# Open URL in local browser
gh rdm open https://github.com
# Fetch latest screenshot from local Desktop (auto-copies @ ref to clipboard)
gh rdm screenshot
# Fetch clipboard image (use ⌘⇧⌃4 to screenshot to clipboard)
gh rdm clipboard-image
# Save screenshot to a custom directory
gh rdm screenshot -o ~/images
# Disable auto-copy of @ reference
gh rdm screenshot --copy=falseWhen SSH'd into a Codespace, macOS screenshots reference local paths that the remote can't access.
Use gh rdm screenshot to pull images through the SSH tunnel:
# 1. Take a screenshot on your Mac (⌘⇧4)
# 2. In the Codespace terminal:
gh rdm screenshot
# Output:
# 📸 Saved: /tmp/screenshot-20260306-120000.png (245820 bytes)
# @/tmp/screenshot-20260306-120000.png
# 📋 Copied to clipboard
# 3. ⌘V to paste the @ reference into Copilot CLIOr capture directly to clipboard and pull:
# 1. Screenshot to clipboard (⌘⇧⌃4)
# 2. In the Codespace:
gh rdm clipboard-imageAdd to your shell profile so pbcopy works inside tmux over SSH:
alias pbcopy="gh rdm copy"Configure the clipboard provider in your Neovim config:
vim.g.clipboard = {
name = "gh-rdm",
copy = {
["+"] = "gh rdm copy",
["*"] = "gh rdm copy",
},
paste = {
["+"] = "gh rdm paste",
["*"] = "gh rdm paste",
},
cache_enabled = true,
}Use gh rdm open as the browser for the GitHub CLI:
gh config set browser "gh rdm open"Add to ~/.zshenv so open works transparently on the remote:
alias open="gh rdm open"make help # see all targets
make build # build binary
make test # run tests
make ci # build + vet + test-race
make install-local # install extension from checkout