Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Background is that you have multiple github.com or bitbucket.org accounts configured on your client
- and want you want to deploy to a remote server using ssh AgentForwarding.
- Issue is that ssh client will try all keys and use first which connects to remote host,
- which may be wrong, personal instead of company, or vice versa.
- Make sure your key is added to `ssh-agent`
- ```bash
- ssh-add -l | grep me@personal
- # 2048 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db me@personal (RSA)
- ```
- `~/.ssh/config` on client:
- ```
- Host personal-app-deploy
- Hostname myapp.com
- ForwardAgent true
- ```
- To force ssh client to use correct key from agent,
- you add **public** key to the server.
- You can get public key with `ssh-add -L | grep me@personal`
- `~/.ssh/bitbucket.pub` on server:
- ```
- ssh-rsa AAAAB3NzaC... me@personal
- ```
- Tell ssh client to use that key.
- `~/.ssh/config` on server:
- ```
- Host bitbucket.org
- Hostname bitbucket.org
- IdentityFile ~/.ssh/bitbucket.pub
- IdentitiesOnly yes
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement