# Remove specific keysssh-add -d ~/.ssh/id_githubssh-add -d ~/.ssh/id_gitlab# OR remove ALL keys from agentssh-add -D# Verify removalssh-add -l
Remove from macOS Keychain
# Remove specific keys from keychainsecurity delete-generic-password -s "SSH: ~/.ssh/id_github"security delete-generic-password -s "SSH: ~/.ssh/id_gitlab"# OR use Keychain Access app:# 1. Open "Keychain Access" # 2. Search for your key names (id_github, id_gitlab)# 3. Right-click and delete entries
Delete Physical Key Files
# Remove GitHub keysrm ~/.ssh/id_githubrm ~/.ssh/id_github.pub# Remove GitLab keys rm ~/.ssh/id_gitlabrm ~/.ssh/id_gitlab.pub# List remaining keys to verifyls -la ~/.ssh/
Clean SSH Config (Optional)
# Edit SSH confignano ~/.ssh/config# Remove or comment out the Host entries:# Host github.com# HostName github.com# User git# IdentityFile ~/.ssh/id_github# AddKeysToAgent yes# UseKeychain yes# Host gitlab.com# HostName gitlab.com # User git# IdentityFile ~/.ssh/id_gitlab# AddKeysToAgent yes# UseKeychain yes
Remove from GitHub/GitLab
GitHub: Settings > SSH and GPG keys > Delete the key