Created
February 3, 2026 14:49
-
-
Save withakay/6ffeac68fc1b174963dae271baad095b to your computer and use it in GitHub Desktop.
Direnv / bash / zsh config to use standard ssh-agent when being accessed over ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # direnv config for remote shells | |
| # | |
| # When logged in over SSH (no Touch ID), bypass 1Password's SSH agent for GitHub | |
| # by forcing git's SSH to use a user-level remote config (password-based, no biometric). | |
| # Also disable git commit signing since it requires 1Password agent. | |
| if [ -n "${SSH_CONNECTION-}" ] || [ -n "${SSH_CLIENT-}" ] || [ -n "${SSH_TTY-}" ]; then | |
| export SSH_AUTH_SOCK="$HOME/.ssh/ssh-agent.sock" | |
| if ! ssh-add -l >/dev/null 2>&1; then | |
| rm -f "$SSH_AUTH_SOCK" | |
| eval "$(ssh-agent -a "$SSH_AUTH_SOCK")" >/dev/null | |
| fi | |
| export GIT_SSH_COMMAND="ssh -F ~/.ssh/config_remote" | |
| export GIT_CONFIG_COUNT=1 | |
| export GIT_CONFIG_KEY_0="commit.gpgsign" | |
| export GIT_CONFIG_VALUE_0="false" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Host * | |
| IdentityAgent ~/.ssh/agent.sock | |
| IdentityFile ~/.ssh/id_ed25519 | |
| IdentitiesOnly yes | |
| AddKeysToAgent yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment