Advertisement
LorenzoPagliara

ssh_bitbucket.sh

Nov 8th, 2024 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Generates a new SSH key for BitBucket
  4. #
  5. # Usage:
  6. # bash ssh_bitbucket.sh <bitbucket email address>
  7. #
  8. # Dependencies:
  9. # sudo apt install xclip openssh-client
  10. #
  11.  
  12. ps -auxc | grep ssh-agent
  13. eval $(ssh-agent)
  14. cd ~
  15. ssh-keygen -t ed25519 -b 4096 -C $1 -f ssh-bitbucket
  16. ssh-add ~/ssh-bitbucket
  17. mkdir -p ~/.ssh/
  18. mv ~/ssh-bitbucket ~/ssh-bitbucket.pub ~/.ssh/
  19. echo "Host bitbucket.org
  20.  AddKeysToAgent yes
  21.  IdentityFile ~/.ssh/ssh-bitbucket" > ~/.ssh/config
  22. cat ~/.ssh/ssh-bitbucket.pub | xclip -selection clipboard
  23. echo "Now connect to https://bitbucket.org/account/settings/ssh-keys/, press 'Add key' and paste in the 'Key' field"
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement