Advertisement
Guest User

Untitled

a guest
May 25th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. Background is that you have multiple github.com or bitbucket.org accounts configured on your client
  2. and want you want to deploy to a remote server using ssh AgentForwarding.
  3.  
  4. Issue is that ssh client will try all keys and use first which connects to remote host,
  5. which may be wrong, personal instead of company, or vice versa.
  6.  
  7. Make sure your key is added to `ssh-agent`
  8.  
  9. ```bash
  10. ssh-add -l | grep me@personal
  11. # 2048 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db me@personal (RSA)
  12. ```
  13.  
  14. `~/.ssh/config` on client:
  15. ```
  16. Host personal-app-deploy
  17. Hostname myapp.com
  18. ForwardAgent true
  19. ```
  20.  
  21. To force ssh client to use correct key from agent,
  22. you add **public** key to the server.
  23.  
  24. You can get public key with `ssh-add -L | grep me@personal`
  25.  
  26. `~/.ssh/bitbucket.pub` on server:
  27. ```
  28. ssh-rsa AAAAB3NzaC... me@personal
  29. ```
  30.  
  31. Tell ssh client to use that key.
  32. `~/.ssh/config` on server:
  33. ```
  34. Host bitbucket.org
  35. Hostname bitbucket.org
  36. IdentityFile ~/.ssh/bitbucket.pub
  37. IdentitiesOnly yes
  38. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement