Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amaddio/d8401dcaaf479e6c856f860f33525265 to your computer and use it in GitHub Desktop.
Save amaddio/d8401dcaaf479e6c856f860f33525265 to your computer and use it in GitHub Desktop.
update bitbucket ssh key
# bitbucket changes keys on 20. Juni 2023. See: https://bitbucket.org/blog/ssh-host-key-changes
# check if the bitbucket ssh key is already in place
if [[ $(ssh git@bitbucket.org host_key_info | grep -c ybgmFkzwOSotHTHLJgHO0QN8L0xErw6vd0VhFA9m3SM) -eq 1 ]]; then
printf 'key is already correctly in place';
else
# if the bitbucket ssh key is not in place, then add it
ssh-keygen -R bitbucket.org && curl https://bitbucket.org/site/ssh >> ~/.ssh/known_hosts
if [[ $(ssh git@bitbucket.org host_key_info | grep -c ybgmFkzwOSotHTHLJgHO0QN8L0xErw6vd0VhFA9m3SM) -eq 1 ]]; then
printf 'key has been added to your ~/.ssh/known_hosts file';
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment