Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can't deploy sftp to production with change port Edited

I have a bitbucket account. I'm trying to build pipelines using sftp deploy, the problem comes when I change my ssh port. When I commit, the output deployment fails.

debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server-> client cipher: MAC: <implicit> compression: none
debug1: kex: client-> server cipher: MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256: WgnXplwkwYNXMVdzcKpILAlYZJ43Y7mm / qMNdHyZ7Fk
debug1: checking without port identifier
Host key verification failed.
Connection closed
Connection closed.
+ STATUS = 255
+ set -e
+ [[255 == \ 0]]
+ file 'Deployment failed.'
+ echo -e '\ e [31m✖ Deployment failed. \ e [0m'
+ exit 255
✖ Deployment failed.

This is my bitbucket-pipelines.yml config.
image: python: 3.7.3

    - step:
        name: Build and test
          - pip
          - pip install - upgrade pip
          - git clone linuxteknosia / codeku.git
          - my code / **
    - step:
        name: Deploy artifacts using SFTP to PROD
        deployment: production
          - pipe: atlassian / sftp-deploy: 0.5.0
              USER: $ USER
              SERVER: $ SERVER
              SSH_KEY: $ SSH_KEY
              REMOTE_PATH: '/ var / www / html'
              LOCAL_PATH: 'my code / *'
              DEBUG: 'true'
              EXTRA_ARGS: '-P 999'

Strangely, when the ssh port uses port 22, the config is successfully committed to the server. Can you help where the fault lies?

1 answer

Hi @linuxteknosia , try adding your host:port to the list of known hosts in pipelines settings, as described here . 

Go to the Repository settings > Pipelines > SSH Keys , enter the host:port into the 'Host address' field under the Known hosts section and click Fetch. This should add and known_hosts entry with a specific port number.

If the above steps don't help, try removing all entries from known hosts settings and add fresh fingerprints instead.

Right, thank you

i'm having same issue. put host:port gets the fingerprint and i can add the host. but the pipeline process don't work, i got "Host key verification failed". if i put just the host without port, the fingerprint is not found.

remove entries from known hosts and add again, doesn't help

any ideas?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

3,808 views 64 20
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you