How to clone bitbucket repo during pipelines run Edited

So following


I am having issues. I have generated SSH key from the pipelines settings in the bitbucket settings for my pipeline repo, and added the pub key to the other repo I want to clone.


I then have my first step as:

- git clone


And I am getting:

+ git clone
Cloning into 'repo'...
Host key verification failed.
fatal: Could not read from remote repository.


Even though the docs say "Note that Bitbucket Pipelines automatically adds the fingerprint for the Bitbucket and GitHub sites to all pipelines" I still tried to add it to the known hosts in the pipelines settings. Even then, I still got the same error.


What do I need to do to get this working?

3 answers

0 votes
Joshua Tjhin Atlassian Team Apr 25, 2017

Hey, that seems strange.

Could you cat your known_host file by adding the following to your scripts?

cat ~/.ssh/known_hosts

Or if you raise a support ticket, we could help you further.

Was this ever resolved? I have the same issue.

Same issue here.

I've the same problem. And the funny thing that it worked before. 

+ umask 000

+ GIT_LFS_SKIP_SMUDGE=1 git clone --branch="master" --depth 50 https://x-token-auth:$ $BUILD_DIR ; git reset --hard cad678d0edbcdfb8937ca46e05d8a554dc727707 ; git remote set-url origin
Cloning into '/opt/atlassian/pipelines/agent/build'...
fatal: repository 'https://x-token-auth:$' not found


Try this, I experienced the same behaviour.

I opt out from Bitbucket Labs -> New source browser experience; and pipelines went back to normal.

Dude. This comment wins the internet today. ++ for fix that had me running in circles for HOURS. Gotta love it when disabling a completely unrelated feature fixes a problem. I owe you many drinks/coffees/insert vice here @José Elizondo. Thank you.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,906 views 7 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you