Monday, April 6, 2026

Fix Jenkins Host Key Verification Failure with BitBucket

BitBucket changed their host keys in 2023, and this will cause problems when verifying connections through Jenkins.  If you are running Jenkins on a Windows machine, you will need to update your known_hosts file with the new host keys from BitBucket.

The known_hosts file is located at C:\Users\<Jenkins user>\.ssh\known_hosts.  This is a text file.  If it does not exist, create it.

In the file, add entries for the new BitBucket host keys.  There are 3 keys in total:

  1. ecdsa-sha2-nistp256
  2. ssh-ed25519
  3. ssh-rsa
Place each key on its own line in the text file.  You can look up the specific keys in the linked BitBucket post.  Use the following format:

bitbucket.org ecdsa-sha2-nistp256 <key value> 
bitbucket.org ssh-ed25519 <key value>
bitbucket.org ssh-rsa <key value>

When you are done, save the file and restart the Jenkins service.  Additionally, in Jenkins -> Manage Jenkins -> Security, make sure the "Git Host Key Verification Configuration" has "Host Key Verification Strategy" set to "Known hosts file".  This is generally the default, but it's worth checking.  You should now be able to use Jenkins to sync with BitBucket.

No comments:

Post a Comment