β New script: SSH mux restart
β’ 259 words β’ 2 min β’ updated
After experiencing almost daily frustration because of this SSH auth issue, I
decided to script a solution out of it: and now
ssh_mux_restart
was born.
A copy of the README.md follows below for ease of reference.
The use case is very simple: run the ssh_mux_restart script whenever I run
into a git SSH authentication error, typically due to git pull, git fetch or
git push.
Usage #
Basic usage to kill SSH multiplexed connections:
bash
./ssh_mux_restart.shTo also restart the 1Password SSH agent:
bash
./ssh_mux_restart.sh --restart-1passwordExample Output #
% ./ssh_mux_restart.sh
Finding SSH multiplexed connections...
Found SSH multiplexed connections:
88002 ssh: /tmp/ssh-control-FLAPJACK42 [mux]
88123 ssh: /tmp/ssh-control-WAFFLE55 [mux]
Killing SSH multiplexed connections...
β Killed SSH mux process: 88002
β Killed SSH mux process: 88123
Killed 2/2 SSH multiplexed connections.
All operations completed successfully!With the --restart-1password flag:
% ./ssh_mux_restart.sh --restart-1password
Finding SSH multiplexed connections...
Found SSH multiplexed connections:
88002 ssh: /tmp/ssh-control-PANCAKE99 [mux]
Killing SSH multiplexed connections...
β Killed SSH mux process: 88002
Killed 1/1 SSH multiplexed connections.
Restarting 1Password application...
Found 1Password process: 67690
Quitting 1Password...
β 1Password quit successfully
Starting 1Password...
β 1Password started successfully
1Password SSH agent is now ready for use.
All operations completed successfully!Why This Matters #
SSH multiplexed connections can cache stale authentication credentials, causing issues when:
- GitHub organizations enable or enforce SAML SSO
- 1Password SSH agent credentials need refreshing
- SSH keys have been rotated or updated
Restarting these connections forces SSH to re-authenticate with fresh credentials.
Prerequisites #
- Standard Unix tools (
pgrep,pkill) - 1Password app (macOS) if using the
--restart-1passwordflag
Backlinks
- new script: copy (Nov 04, 2025)