I'm getting this error when trying to run a plan that retrieves the code/metadata from a Salesforce instance to a repository on Bitbucket.
Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I know that to push changes to a remote repository I need some kind of authentication, right. However, I don't know exactly where and how to set this up on Bamboo. My company is not using Stash or JIRA, just Bitbucket and Bamboo.
I have tried generating a key pair with puttygen and putting the public on Bitbucket, and the private key in the "Shared Credentials" section on Bamboo settings, and it doesn't work.
I have also tried to log into the Bamboo server with the pair provided by Amazon, and generating a pair from inside, using ssh-keygen. It didn't work either.
Where can I specify the key that Bamboo should use with this repo when pushing files?
Thank you for your question.
Please, create a Script task with the following example:
# create file echo "hello, world" > greeting.txt # add file git add greeting.txt # commit git commit -m "add greeting" # set url to push # [username], i.e.: renato # [password], i.e.: mypassABC # [account-name], account name where the repository is hosted under # [repo-slug], given name to the repository git remote set-url --push origin https://[username]:[password]@bitbucket.org/[account-name]/[repo-slug].git # push to Bitbucket repository git push origin master # remove origin git remote remove origin
The above will let you push files to your repository. Please, notice in the example above it has been used HTTPS protocol instead of SSH. The reason for that is that Bamboo will expect you to type in the password for your SSH key while running the build.
Alternatively, you could create a passphraseless SSH key and replace the origin above to use this key.
If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.
Thank you for your understanding.
Rafael P. Sperafico
Hi Rafael and Renato,
We've ended up solving this problem by changing the dependency URL from SSH to HTTPS, and then specifying the user/pass in the URL using the "//[user]:[pass]@domain.com/team/repo.git" format.
We created a new read-only user with restricted permissions, and used their credentials for this. This has made the build succeed without any further Bamboo-specific configuration needed.
It's not the clean solution we were hoping for, but until Bamboo has support for specifying SSH config in non-checkout tasks, it'll have to do
PS. I've removed my previous answer because it was a horrible hack.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda ...
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!
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