tvolf
tvolf

Reputation: 309

Error while fetching a Bitbucket private repository

I'm using an Openshift 3 service. I'm trying to fetch data from my private Bitbucket repository. With using PuTTy for Windows I've created public and private SSH keys. The public key was loaded successfully as Access key into Bitbucket. Then I created a new secret through Openshift web console for my app, set it as SSH, loaded a private key and link this secret with builder service. After this I modified build configuration and set for my Bitbucket repo a secret with required name (choosen from dropdown box). But when I'm running a build process ("Start build") I'm getting an error "Fetch source failed". There are lines from my build log:

Cloning "ssh://bitbucket.org/<my_name>/<my_private_repo>.git" ...
error: build error: Warning: Permanently added 'bitbucket.org,104.192.143.3'  (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Is it possible to set up building process from web console ? Thanks in advance for any suggestions.

Upvotes: 1

Views: 1732

Answers (1)

Gregori
Gregori

Reputation: 829

To have OpenShift v3 works with a private BitBucket repo, I used the following:

  1. In OpenShift Web Console, create a project

  2. Create a secret using your Bitbucket login information

    * Web console version *

    • From the web console, click on the project name in the breadcrumb and you will see the left side menu.

    • Select Resources > Secrets

    • Click Create Secret (top right)

    • Leave Basic Authentication

    • Enter a Secret name bitbucket

    • Enter your Bitbucket username and password

    • Click Create

    • Click Add to Project

    * Command line version *

    • Add a secret that stores your BitBucket login:

    $ oc login 
    This should select your project or if it did not, use the oc project PROJECTNAME

    $ oc secrets new-basicauth bitbucket --username=gregorifaroux -- password=MY_PASSWORD
    $ oc secrets link builder bitbucket

  1. In the Web Console, I select Java & WilfFly

  2. Put your Git URL:


    https://[email protected]/gregorifaroux/MYPRIVATEREPO.git

  1. Click the Advance Options link, and then select the Secret Pull:

    bitbucket

And it should worked. If you already did a build, you can click Edit and then Advance Options to select the pull secret.

I could not get the Key to work following the different blog and documentation.

Upvotes: 2

Related Questions