youngmon/atlassian-qna huggingface dataset:
SSH key is not working
Asked by Ishaan:

I have two private repos and I am using one repo as a library.

I configured for ssh key for one and add it's public key to another's access key.

I am using npm to install another repo as a library.

It works well locally but not working on the main repo's bitbucket pipeline.

Following one is the my example in package.json

"private-module": "git+ssh://git@bitbucket.org/\[owner\]/\[repo\]git#0.2.0",

Would you please help me?


Answers:
author: Mark C
body: Hi [@hiroshi](/t5/user/viewprofilepage/user-id/4469362)

Welcome to the community.

You mentioned that you configured an SSH key and added the public key to another repository as an **Access key** .  
For this, when you run it on Pipelines, would it be possible for you to confirm if you also added the configured public SSH key on Pipelines?

1. Go to your repository <https://bitbucket.org/workspace_id/repo_name/>
2. Click **Repository settings**
3. Click **SSH keys**

If not yet, would you be able to add it there using the above steps and run your Pipelines build again?

Let me know how it goes.

Regards,  
Mark C


Tags: bitbucket-cloud

cloud
restrict user to specific folder only
Asked by Hardik Patel:

Hello,

I want to give access of specific folders in repo to user.

Is there a way to complete this scenario?

Thanks in advance.


Answers:
author: Caroline R
body: Hi, [@Hardik Patel](/t5/user/viewprofilepage/user-id/4442881)!

Currently, you can restrict access to a repository in general or prevent users from pushing content either to the repository or to a specific branch with the **write access permissions** and **branch permissions** respectively.

We don't have a feature to prevent access to view specific folders in a repository, however, we do have an opened feature request to gather user interest and perhaps see it implemented in Bitbucket:

* ?<https://jira.atlassian.com/browse/BCLOUD-20466>

All enhancements take into consideration the number of customers who are benefited and/or the impact of the change along with the evaluation of how complex it is to implement. If this feature gets prioritized, an ETA will be shared through the public feature ticket.   
?  
If you are not familiar with our Feature Request Policy, you can read more about it here:

* [Implementation of New Features Policy](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html)

Our product team will give a first-hand update through that ticket if there's any progress made, so I would suggest keeping a watch and vote for it.

With that said, if you would like to prevent access to specific files or folders, my suggestion would be to have these folders in a separate repository.?

Please, feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
Bitbucket Smart Mirror Database Set Up
Asked by Qibin Tan:

Hello, community team.

We have a separated instance set up for mirror configuration and wondering how we configure the jdbc to make the mirror work. Couldn't find any document about how to set up the database for the mirror. We're using Postgres and it throws error - "org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode \[90020-176\]" when starting the mirror application.

Thanks


Answers:
author: Christian Glockner
body: Hi Qibin,

Mirrors use a built-in database and there is no need to configure anything.

Cheers,

Christian

Premier Suport Engineer

Atlassian

comments: author: Qibin Tan
body: Thank you Christian for the reply!

All works now after removing the installed database.

Thanks,

Qibin


Tags: bitbucket-data-center

bitbucket-server

mirror

server
We need to run git gc, how to run this command on a remote repository?
Asked by chernandez_energy:

Our repository weighs 2.8 GB, we need to optimize the repository with the git gc command, but we can't find how to do it.


Answers:
author: Caroline R
body: Hi, [@chernandez_energy](/t5/user/viewprofilepage/user-id/4468788)! Welcome to the community!

I ran the GC against your repository and managed to reduce its size.

To give you some context around the git GC process, Bitbucket triggers a garbage collection on the repository after each push, however aggressive GC is triggered by GIT once the unreachable/dangling objects become older than 30 days.

For this reason, there is no need for us to trigger a manual GC for your repository. However, we are happy to run it for you if you feel there is a need.

We already have a feature request to allow users to mark repositories for git GC, as you can check here:

* <https://jira.atlassian.com/browse/BCLOUD-11593>

Please consider adding yourself as a watcher to receive the updates as we make progress with this. If you are not familiar with our Feature Request Policy, you can read more about it [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html).

Feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline

comments: author: chernandez_energy
body: Great !!

Understood, I'll keep that in mind.

Thank you so much!!


author: Caroline R
body: You're welcome, [@chernandez_energy](/t5/user/viewprofilepage/user-id/4468788)! Feel free to reach out if you ever need anything else.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
docker fails to push image to gcp while running bitbucket pipelines
Asked by Adam Read:

i have been having this issue lately when i am trying to deploy a new version of the app

the pipeline fails because it cannot push the image that was just created to the registry.

we are using GCP as the registry.

```
+ docker push eu.gcr.io/$GCP_PROJECT_ID/webapp:$BITBUCKET_COMMIT
The push refers to repository [eu.gcr.io/$GCP_PROJECT_ID/webapp]
5cc2bfc009e2: Preparing
.....
10791dd0d7c7: Waiting
denied: Access denied.
```

the weird thing is that logging in to docker seems to work

```
+ cat keyfile.json | docker login -u _json_key --password-stdin https://eu.gcr.io
WARNING! Your password will be stored unencrypted
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
```


Answers:
author: Theodora Boudale
body: Hi Adam and welcome to the community.

The "Access denied" error indicates most likely an issue with the credentials used to authenticate to the registry.

Would you be able to check if the credentials have been set up correctly, if they have the appropriate permissions to push to the registry, or if they have been recently changed?

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

docker

google
bypass branch restrictions as permission option for Bitbucket Pipelines?
Asked by Mathijs:

It seems to me that it's possible to bypass branch restrictions as permission option for Bitbucket Pipelines:

I have configured the following deployment restrictions:

```
Environment name: Production
Branches allowed to deploy to Production: master
```

Bitbucket-pipelines looks like this:

```
branches:
  master:
    - step:
      name: Deploy
      deployment: production
      script:
        - echo "deploy"
```

This works as expected: I can only deploy my master branch to production and no other branches.

<br />

Now I create a branch in which I remove *deployment: production* from bitbucket-pipelines.  
This makes it possible to run pipeline branches:master for this branch, as the branch restriction appears to be out of order.

Is this intended? Is there another way to make it impossible to run master / production pipelines for arbitrary branches?


Answers:
author: Caroline R
body: Hi, [@Mathijs](/t5/user/viewprofilepage/user-id/1687531) !
> `Now I create a branch in which I remove deployment: production from bitbucket-pipelines.`

I assume that you edit the yaml file and remove the deployment: production in the new branch you create, is that correct? If this is the case, you are correct. It will be possible to run pipeline branches:master for this branch. Since deployment: production will be missing from the yaml file, this will no longer be a deployment step so the branch restriction cannot be enforced.

However, if you have defined any credentials needed for the deployment as deployment variables, these deployment variables won't be available in the pipeline branches:master (since it will be missing the "deployment: production" part), and the deployment will fail.

My suggestion would be to use deployment variables for authentication (instead of repository or workspace variables) to the deploy server, as this way the deployment will fail when the "deployment: production" is missing.

Please, feel free to share any additional questions regarding this case.

Kind regards,  
Caroline


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

deployment

security
Migrate only selected commits from gitlab repo to bitbucket repo
Asked by SJ Office:

Hello,

I have a doubt regarding migrating only a couple of commits from gitlab to bitbucket.

I have already migrated the entire project repo from gitlab to bitbucket.

But later a colleague of mine added some commits in gitlab which now needs to be moved to bitbucket.

How do I migrate only selected commits from gitlab to bitbucket ?

Thanks.

SJ


Answers:
author: Caroline R
body: Hi, [@SJ Office](/t5/user/viewprofilepage/user-id/4467791)! Welcome to the community!

It's not possible to migrate only selected commits from GitLab to Bitbucket. However, you can give this user access to the repository on Bitbucket, this way they can commit the changes to the new repository. So, this is what I would suggest:

* Give this user access to the repository on Bitbucket;

* Ask them to change the remote URL on their local repository by running the following command:

    git remote set-url origin {new URL here}

* Ask them to run the following command to make sure they have set the correct remote repository:

    git remote -v

* Ask them to check out those commits to a brand new branch and only push that branch to the remote repository;

* Then, they can use a Pull Request to merge the changes into the main branch on the Bitbucket repository;

* This will assure that they do not introduce conflicts and do not do a force push that could potentially cause damage to the new data on Bitbucket.

I hope this helps, but do let me know if you have any questions.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud

gitlab
Bitbucket pipeline not picking up changed node version
Asked by Pratik Jaiswal:

I have changed the Node.js image in bitbucket-pipeline.yml file but still, the bitbucket pipeline is picking some other node version.

Updated node.js image

    image: node:14.17.1

The old node.js image in the pipeline was

    image: node:10.15.3

But bitbucket pipeline is picking up node version **10.12.0**.

What am I doing wrong? Thanks in advance


Answers:
author: Theodora Boudale
body: Hi Pratik and welcome to the community.

I haven't been able to reproduce the issue you are reporting, when I run a build with image node:14.17.1, the command **node -v** gives as output **v14.17.1**.

An image can be defined either at a global level or at the step level, so it's possible that the step that shows an older node version is using a different image.

Can you check the bitbucket-pipeline.yml file and see if there is a different Docker image defined specifically for the step that shows an older node version?

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines
Pipeline was paused because Production can only be deployed to from permitted branch pipelines.
Asked by Mathijs:

Hi,

I configured deployment restrictions for Bitbucket Pipelines:

* Environment name: Production
* Branches allowed to deploy to Production: master

I deploy to production by tagging the master branch with a release tag in bitbucket-pipelines.yml:

```
tags:
  release/*:
    - step:
      name: Deploy
      deployment: production
      script:
        - echo "deploy to production"
```

When pushing a release tag to Bitbucket I get this message:
> This pipeline was paused because [Production](https://bitbucket.org/mediquest-nl/test-deployments/addon/pipelines/deployments) can only be deployed to from permitted branch pipelines.

What am I doing wrong here? Or is it not possible to use tags in combination with deployment restrictions?


Answers:
author: Theodora Boudale
body: Hi [@Mathijs](/t5/user/viewprofilepage/user-id/1687531),

I'm afraid that tags cannot be used with deployment restrictions on branches at the moment.

If you have a branch restriction for a deployment, Pipelines will allow this deployment only if it's used in the definition of one of the branches you selected and not in the definition for tags.

We have a feature request to allow restrictions based on tags as well:

* <https://jira.atlassian.com/browse/BCLOUD-21048>

If you'd be interested in that, I would suggest that you add your vote in the feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

continuous-delivery

deployment
How do I do continuous integration from a specific branch by using different repo?
Asked by Alan Andres Haro:

I'm currently working on a bitbucket pipeline where I have my cypress files running pretty well. The thing is here is that I don't know how to configure the new repo to make sure it gets deploy every time that we do a pull request from an old repo. Does anyone knows if this is possible to do it through Bitbucket or do you recommend any other resources?  


Answers:
author: Shrikant Wagh
body: It requires configuring your build target, deploy targets and test targets etc. And it depends on what and what type of those target? Bitbucket, Github actions or Jenkins they all have more or less similar features

comments: author: Alan Andres Haro
body: It's for bitbucket but their documentation does not specify what we have to do through bitbucket. I found a solution for Jenkins but my current project has to be done under bitbucket.


Tags: bitbucket-cloud

bitbucket-pipelines

branch

cloud

cypress

javascript
Unable to add user
Asked by Mayank:

Hi,

I am unable to add user \<email_removed\> to our account. He was earlier the member, then was removed temporarily. Now when we are adding the user back, he isnt getting email. Please check.


Answers:
author: Caroline R
body: Hi, [@Mayank](/t5/user/viewprofilepage/user-id/1869667)!

We performed an analysis on our logs and confirmed that the email you shared with us (I removed the email you mentioned from your answer for security reasons) had a block on the server that prevented emails from being sent to this recipient. This can occur when the system tries to send an email to the user and the account does not exist yet, is not activated, or it rejects the email for some internal reason. The message on the email was:
> 550: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 Gmail Help ... - gsmtp

So, I have removed the block from this address, could you please try to remove the invitation and send them a new one? You can do this by following the next steps:

* Access the workspace;

* Go to **Settings** \> **User groups**;

* Access the group the user was invited to;

* Remove the invitation by clicking on the X next to the email and send them a new one;

In addition, I would like to share with you that we already have an open bug for our development team regarding this problem, as currently there is no indication of when an invitation email is blocked/rejected. You can access it here:

* <https://jira.atlassian.com/browse/BCLOUD-20659>

I've linked your question to the bug. Please consider adding yourself as a watcher. This way you get updated as we make progress with this. If you are not familiar with our Bug Request Policy, you can read more about it [here](https://confluence.atlassian.com/support/atlassian-cloud-bug-fix-policy-206865884.html).

Please, feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
Git LFS pull with SSH Access Key breaks when two step verification required
Asked by Zane Hooper:

Discovered the following bug today, repro steps:  

1. Upgrade to a premium bitbucket account
2. Go to a repository that has Git LFS files in it \> Settings \> Access Keys \> Add a key
3. Under Settings \> Access Management \> Access Controls, require 2FA
4. Try to use that access key to clone the repo

Expected result: clone repo successfully

Actual result: The SSH request to generate a JWT token works, but there is a 403 error while trying to download the relevant files from git LFS.


Answers:
author: Theodora Boudale
body: Hi Zane,

Thank you for reporting this.

We have a bug report about this in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-18351>

Until this is fixed, a workaround would be to authenticate with a user that has access to the repo, using an [app password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) with read-only scope.

Our development team will post an update on the bug report when this is fixed. Please note though that we don't provide ETAs and bug fixing is implemented as per our policy [here](https://confluence.atlassian.com/support/atlassian-cloud-bug-fix-policy-206865884.html).

You can add yourself as a watcher (by selecting the **Start watching this issue** link in the bug report) if you'd like to get notified via email on any updates. You can also select the **This affects my team** link to indicate you are affected by this issue.

If you have any further questions, please feel free to let me know.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
how can I grant permission to create projects in bitbucket to other member of my team?
Asked by Andrey Baevich:

I made my team member an administrator, but he can't create projects in bitbucket, how can I fix it?


Answers:
author: Caroline R
body: Hi, [@Andrey Baevich](/t5/user/viewprofilepage/user-id/4345189)! Welcome to the community!

In order to be able to create a repository under a workspace, the user needs to have the "Create repositories in this workspace" permission. In this case, you can either edit the group you have created or create a new group and select this option. You can follow the next steps to edit this group:

* Access the workspace \> **Settings** \> **User groups**

* Select the group you have created and click on **Edit**

* Then, select the option "**Can create repositories in this workspace** " and click **Confirm**:

![Screen Shot 2021-07-07 at 11.43.04 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/150410i289F2858595490AA/image-dimensions/316x261?v=v2 "Screen Shot 2021-07-07 at 11.43.04 AM.png")

I have created this video to show you this process:

* [Adding create repository permission](https://share.getcloudapp.com/7Kuon25v)

After that, all users under this group should be able to create repositories under this workspace.

Please let me know how it goes and feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
ERROR: file or directory not found: tests/*
Asked by Test Account:

I am new to use bitbucket, when I tried setting up the pipeline, the YAML file **bitbucket-pipelines.yml** gives an error saying **ERROR: file or directory not found: tests/\***

```
image: python:3.8
pipelines: default: - parallel: - step: name: Test caches: - pip script: - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install pytest - pytest -v tests/* --junitxml=test-reports/report.xml - step: name: Lint code script: # Enforce style consistency across Python projects https://flake8.pycqa.org/en/latest/manpage.html - pip install flake8 - flake8 . --extend-exclude=dist,build --show-source --statistics
```

can anyone help me on this?


Answers:
author: Theodora Boudale
body: Hi [@Test Account](/t5/user/viewprofilepage/user-id/4414433),

Which command gives you this error? I assume it's the following one?

```
pytest -v tests/* --junitxml=test-reports/report.xml
```

The error indicates that the **tests** folder does not exist in the repository. The **pytest** command expects to find files with tests in this directory.

If you have these files in a different directory in your repository, you'll need to replace **tests/\*** in the command in your yml file with the path of the directory where the tests exist.

Please feel free to let me know how it goes and if you have any further questions.

Kind regards,  
Theodora


Tags: bitbucket-pipelines

cloud
How long time is the pipeline history saved?
Asked by MartinFrolund:

I'm working in a medico company on a CE certified product, and it is important for us to be able to trace back how a Jira issue has been tested in Bitbucket pipeline. As answered in <https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-pipelines-history-kept-after-branch-deletion/qaq-p/1053233>, I understand that even after deleting a branch, the pipeline history is kept. But is there any limit to how long time this history is kept?


Answers:
author: Theodora Boudale
body: Hi Martin,

There is no limit for how long Pipelines builds are kept.

All Bitbucket Pipelines builds (including those associated with a deleted branch) will remain in the repo, for as long as the repo exists.

Please feel free to let me know if you need anything further!

Kind regards,  
Theodora


Tags: bitbucket-pipelines