I keeping gettting host verification failed. I am unclear what username to use before the at symbol? Do I need to use my custom username or bitbucket or git?
I followed this guide here: https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html
I am not sure why it does not work. Here is my pipeline:
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: ubuntu:16.04
pipelines:
custom: #deploy to live site deploy:
- step: name: deploy
script:
- apt-get update -y
- apt-get install -y ssh
- ssh whataccountnamegoeshere@mydomainname.com ~/deploy.sh
The error "Host Key verification Failed" relates to the known_host file entry you have, not the user you are supplying - it indicates that the known_hosts entry you added in step 2 from https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html is no longer the same as the key that is being retrieved when your script tries to ssh - see the answer in https://askubuntu.com/questions/45679/ssh-connection-problem-with-host-key-verification-failed-error
I would remove the known_hosts entry in the pipelines admin ui and re-add the entry for the server you are trying to contact (mydomainname.com in the example above)
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Matthew, it worked for me.. I hadn't added ip of my remote machine in known hosts at https://bitbucket.org/../../admin/addon/admin/pipelines/ssh-keys
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am getting the same problem and have tried removing the record multiple times and re-adding it. The same host works on a different repo but is always failing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Matt, are you saying that ssh-ing to the same host works in one repository but not in another? Does it have the same known hosts fingerprint in each repository?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I have two repos that I deploy to the same host. I successfully set up the first one but the second isn't working. The fingerprint is exactly the same on both and doesn't change when I delete and re-add to known hosts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Weird - could it be possible that you have something in your repo or build script that overrides the ~/.ssh/known_hosts file? The fingerprints you add in the pipelines admin section are added first so could be removed/overridden by anything that gets added later...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, here is the pipelines configuration. Just calling a deploy script to checkout the correct commit on the server. I don't see anything that should affect the known-hosts.
pipelines:
branches:
master:
- step:
name: Deploy to Staging
deployment: staging
max-time: 1
script:
- cat stage-deploy.sh | ssh ${GCLOUD_USER}@${STAGING_HOST} bash -s - ${BITBUCKET_COMMIT}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Doesn't look like there's anything in there that should cause a problem - if this is still happening you might want to open a support request at https://support.atlassian.com/contact/#/ so our support engineers can look into the specifics of your repos for more information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.