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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,647
Community Members
 
Community Events
185
Community Groups

How I can access private bitbucket repository via bitbucket-pipeline?

Edited

If I'm using nodejs version > 12.14, then I'm receiving access error:

+ npm install eslint@8.25.0
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@bitbucket.org/someprivatereponame/someprivatereponame.git
npm ERR! Warning: Permanently added the RSA host key for IP address 'X.X.X.X' to the list of known hosts.
npm ERR! git@bitbucket.org: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-10-26T10_45_48_521Z-debug-0.log

In packages json file package specified like:

"common-module": "bitbucket:someprivatereponame/common-module#v1.0"

where v1.0 is tag in git.

 

My pipeline file:

image: node:18.11

definitions:
  steps:
    - step: &lint
        name: Lint application
        caches:
          - node
        script:
          - npm install eslint@8.25.0
          - npm run lint

clone:
  depth: 1

pipelines:
  branches:
    master: # or the name of your main branch
      - step: *lint

So the question, what needs to be done to resolve this issue with private repo access? How and where I can provide ssh key?

2 answers

1 accepted

0 votes
Answer accepted

I found the issue, it was related to passphrase protected ssh key. So for bitbucket-pipelines we should use non-passphrased keys.

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 26, 2022

Hi @Andrey Selemenev,

Welcome to the community.

You can either generate or use your own SSH keys from your repository Pipelines SSH keys settings.

  • Go to your repository
  • Click Repository settings
  • Click SSH keys (Under Pipelines)

Once you have set up the SSH key there, you can copy the public SSH key and either add it to your account's settings or the private repository Access keys.

After that, you can run your Pipelines build again.

Let me know how it goes.

Regards,
Mark C

Let me try, but what's the difference, why for node v12 it's working fine, but for more new versions it's failing?

BTW, I have followed all your instructions, copy my public key from repo where I have pipeline running, added this key for private package which I need to access, but no luck. I still receiving the same error.

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 31, 2022

Hi @Andrey Selemenev

For your package.json file, could you try the below SSH URL connection?

"common-module": "ssh://bitbucket.org/workspace_id/repo_name.git"


If you're still getting the same error after that, I'm suspecting there's something causing it with the Node version > 12.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events