youngmon/atlassian-qna huggingface dataset:
Migrating from Server to Cloud and switching to LFS
Asked by charles_blessing:

I am currently running a Bitbucket Server instance and I'm in the process of migrating it to the cloud.

The repo has steadily grown over the last few years and is now \~2.5Gb in size, so this seems like a good time to switch to LFS.

Unfortunately, the larger files in the repo are required and I'd rather not lose the history.

From what I've read so far, the best way to convert to LFS is to use [BFG](https://support.atlassian.com/bitbucket-cloud/docs/use-bfg-to-migrate-a-repo-to-git-lfs/), so my main question is, what is the best order to do things in?

1. Import the current repo into the cloud and then convert to LFS.
2. Convert the current repo to LFS and then import into the cloud.
3. Somehow import and convert simultaneously (this would be awesome, but I don't think it's possible).

From the moment I start the process until the moment it is complete, the programmers aren't going to be able to access the repo and they'll have to check-out the new repo when it's all done, so I'm aiming for the safest option with the least down-time. I'm thinking this will be me working after everybody has committed all their changes and signed off for the day.

One side note - I ran a test import/convert (using option 1) and the result was that the repo still claimed to be taking up a ton of space and I also needed a ton of storage. I've seen a few [posts](https://community.atlassian.com/t5/Bitbucket-questions/Repository-not-shrinking-after-migration-to-LFS-What-do/qaq-p/908843) mention that I may need to contact Atlassian support about running a garbage collection to clear this up.

I look forward to hearing your suggestions/comments/ideas/feedback.


Answers:
author: Theodora Boudale
body: Hi Charles,

I'm afraid that the importer in Bitbucket Cloud does not import LFS objects.

My suggestion would be the following:

1. Take a mirror clone of the repo from the Bitbucket Server instance
2. Convert it to LFS
3. Create a new empty repo in Bitbucket Cloud, and push the converted repository to the empty Bitbucket Cloud repo

You can double check whether the LFS objects have been pushed if you go to **Repository settings** (in Bitbucket website) \> **Git LFS**.

I suggest running also the following command inside the converted repo, after you use BFG and prior to pushing it

```
git reflog expire --expire=now --all && git gc --prune=now --aggressive
```

and then you can check the size of the local converted repo with

```
git count-objects -Hv
```

The sum of the fields size-pack and size in the output will give you the size of the git repo. If this differs from the size you see in the remote, you can open a ticket with the support team to run a git gc on the repo.

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

git-lfs

migration
Support for passing HTTP_PROXY and HTTPS_PROXY Env vars for AWS_CLI
Asked by Oscar West:

Hi,

We use the aws-s3-deploy pipe and would like support for setting HTTP_PROXY and HTTPS_PROXY Environment variables for the AWS CLI to pick up: <https://docs.amazonaws.cn/en_us/cli/latest/userguide/cli-configure-proxy.html>

Or is there another way to pass and set arbitrary environment variables for all pipes?

<https://bitbucket.org/atlassian/aws-s3-deploy/src/master/>


Answers:
author: Halyna Berezovska
body: [@Oscar West](/t5/user/viewprofilepage/user-id/3831963)do I understand right that you don't expect aws access keys credentials to be added to repository variables and instead want to add HTTPS_PROXY and use this authentication instead of aws access keys?

Or do you want to be able to use both at the same time (aws access keys for authentication and proxy to access some resources, e.g. s3 bucket via proxy)?

This is the question to better understand your case and try to find out if it is supported or not.

Thanks!

Regards, Galyna

comments: author: Oscar West
body: Hi, essentially we want the aws cli to proxy our aws s3 sync commands via a proxy server. (<https://bitbucket.org/atlassian/aws-s3-deploy/src/f300028f7cf938d2db4f394544e70a52b000a1ff/pipe/pipe.sh#lines-70>)

So still need the aws credentials but we need to set the environment variables for the aws cli to pick up on this.

Maybe something like this:

```
if [[ -n "${PROXY}" ]]; then
  export HTTP_PROXY="${PROXY}"
  export HTTPS_PROXY="${PROXY}"
fi
```

Or is this already supported by passing HTTP_PROXY and HTTPS_PROXY as variables for the pipe? Like this:

```
 pipe: atlassian/aws-s3-deploy:0.4.5  variables:
    AWS_ACCESS_KEY_ID: '<string>' # Optional if already defined in the context.
    AWS_SECRET_ACCESS_KEY: '<string>' # Optional if already defined in the context.    HTTP_PROXY: '<string>' # Optional    HTTPS_PROXY: '<string>' # Optional
    ...
```

Can't seem to find any documentation.


author: Halyna Berezovska
body: [@Oscar West](/t5/user/viewprofilepage/user-id/3831963)I've just tried to pass variables, like in your second approach, it worked.

So I think the second option is supported, you can simply try it.

Looking forward to seeing your feedback, we'll make a support ticket, if there are some problems.

Regards, Galyna


Tags: aws

bitbucket-pipelines

cloud
security: How secured is saving codes on bitbucket repository?
Asked by Ali Shettima:

security: How secured is saving codes on bitbucket repository?


Answers:
author: Nic Brough -Adaptavist-
body: "How secured" is a very vague question.

How are you wanting to measure how secure something is? We can't answer "how secure" without knowing what your measure of it is.

I'd recommend starting at <https://www.atlassian.com/trust/security> if you're not sure what to look at to measure your security
Restrict OAuth consumer to selected repositories
Asked by Amit Rathi:

I'm a founder of [ReviewNB](https://www.reviewnb.com/) and we're trying to build BitBucket integration. Our Oauth app would require "pull_request:write" scope on a \*few\* repositories (which I understand comes with repository read \& write scope as well). Asking access to ALL repositories (when we don't need it) would be a poor security practice.

I'm wondering whether it's possible for customers to restrict our OAuth app to only a handful of selected repositories?


Answers:
author: Amit Rathi
body: Any guidance for this?


Tags: bitbucket-cloud

cloud
Is there any list of bitbucket pull-requests/new query parameters?
Asked by lukas_klima:

Hello, is there any list of this feature?

We already found that we can use **source** and **dest**. But it would be useful another form inputs, is there any way to configure Title and Close checkbox??


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

I assume that you are referring to creation of pull requests via Bitbucket API?  

You can configure PR title with the field **title** which is a string, close source branch checkbox with **close_source_branch** which is boolean (you can set it to true or false).

An example call would be as follows:

```
curl -X POST -u username:app-password https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-slug>/pullrequests --header 'Content-Type: application/json' --data '{"title": "My PR Title ", "source": {"branch": {"name": "feature-branch"}},"destination": { "branch": {"name": "master"}},"close_source_branch":false}'
```

You can see more fields in the following link, in the section that gives examples (you can also set PR **description** and **reviewers**):

* <https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests#post>

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Reduce complexity in Bitbucket & AWS
Asked by Bella Jolie:

How to reduces management complexity without restricting choice in AWS using Elastic Beanstalk?


Answers:
author: Soumyadeep Mandal - SaM
body: Hi [@Bella Jolie](/t5/user/viewprofilepage/user-id/4133034) ,

Please read and follow this documentation <https://support.atlassian.com/bitbucket-cloud/docs/deploy-to-aws-with-elastic-beanstalk/>

I hope it will solve your issue.

Regards,

***Soumyadeep***

comments: author: Bella Jolie
body: That's a quick response! Thanks [@Soumyadeep Mandal - SaM](/t5/user/viewprofilepage/user-id/4216583) for the documentation.


Tags: aws

bitbucket-cloud

bitbucket-pipelines

cloud
Automated deployment of repository to shared server
Asked by viveknarula:

Hi,

I am a novice in managing projects with bitbucket, till now, i have been using git/bitbucket for version controlling only and was not deploying the code to the server.

Now, i want to deploy code directly to my shared server that is with Hostgator. I want to have others in my team, Team members will create a Pull request. I will approve and merge with main master branch of my repository.

Now, what i want it that updated code should be directly deployed on my Hostgator shared server on a domain. I am trying to find various resources but unable to get a clear view so to set it up.

I got resources that i can do the same with Piplines however i am unable to find any resource which can guide me.

There is another resource at [https://bitbucket.org/sibbl/bitbucket-ftp-deployment/wiki/Home](https://bitbucket.org/sibbl/bitbucket-ftp-deployment/wiki/Home?) (seems to be easy) but it seems to be outdated as i am unable to find settings/services options etc...,

So can anyone please guide me to correct resource so that i can move forward with next steps in managing controlled code.

Please help.

Thanks in advance,

Viv


Answers:
author: Theodora Boudale
body: Hi Viv,

You can use Pipelines for automated deployment of the code in your repo to another server.

To enable Pipelines, you'll need to configure a file named bitbucket-pipelines.yml in your repository. If you want deployment to happen every time there is a new commit on master only, your bitbucket-pipelines.yml can have a stricture as follows:

```
pipelines:
? branches: #these will run on every push of the branch
? ? master:
? ? ? - step:
? ? ? ? ? script:
? ? ? ? ? ? - <command>

```

[This documentation page](https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/) has general info on how to configure the bitbucket-pipelines.yml file.

For deployment specifically, we have several pipes that automate this process and you can use them as commands in the *script* section above in order to do a deployment.

To mention a few examples, there is a pipe to deploy using FTP, there is one using scp, another one using rsync. For the last two you will need to set up SSH keys for authentication, if you're not familiar with SSH this may be a bit more complicated to set up.

You could use the FTP one, and for this you'll need to have FTP server installed on your server. Do you have that? Or would you prefer to set up SSH keys and use scp or rsync? Please let me know, and I can provide the relevant documentation for you.

Kind regards,  
Theodora


Tags: bitbucket-cloud
Need help with function to get source branch of pull request
Asked by Shobhit Gupta:

++Hello,++

++Can someone help to know which function can give source branch name when pull request is created.++


Answers:
author: jmarquesadaptavist
body: Hi [@Shobhit Gupta](/t5/user/viewprofilepage/user-id/4232544)

In order to get the source branch name when the pull request is created you can create a [Custom Listener](https://docs.adaptavist.com/sr4bib/6.23.0/features/listeners/custom-listeners) for **PullRequestOpenedEvent** event and then you can use [pullRequest.fromRef.displayId](https://docs.atlassian.com/bitbucket-server/javadoc/7.12.1/api/com/atlassian/bitbucket/pull/PullRequest.html#getFromRef--) in your script.

Many Thanks and Kind Regards,

Jose Marques

Software Engineer - ScriptRunner for Bitbucket


Tags: bitbucket-server

scriptrunner

server
How can I access a private repo within a docker service container?
Asked by Antonios Pavlakis:

Hello

I am using a docker service in bitbucket-pipelines and calling composer from within that container. However, that container does not have permission to access private repositories in bitbucket.

Would I need to create a new user just for the CI with a private key to get this working or is there an easier way to link to the existing account?


Answers:
author: Theodora Boudale
body: Hi [@Antonios Pavlakis](/t5/user/viewprofilepage/user-id/1421724) ,

If you only need to clone (and not push to) another private Bitbucket repo, you can set up ++Access keys++.

Let's say you have repo-A and repo-B, Pipelines is running in repo-A and you want to clone repo-B.

1. In Bitbucket website, go to repo-A's **Repository settings** \> **SSH keys**
2. In that page you can generate an SSH key pair
3. Copy the public SSH key
4. Go to repo-B's **Repository settings** \> **Access keys**
5. Add there the public key you copied before

You will then be able to clone repo-B from Pipelines builds running in repo-A via SSH. You will need to have admin permissions to both repos to access their **Repositories settings** page.

Access keys give read-only access, so if you also need to push to repo-B, you'll need a different approach.

If you don't want to tie authentication to a certain user, you can set up ++OAuth++:

* <https://support.atlassian.com/bitbucket-cloud/docs/push-back-to-your-repository/#OAuth>

If the repos don't belong in the same workspace, you'll need to generate an OAuth consumer in the workspace that owns repo B. You'll need to have admin permissions in the workspace to do that.

Please note that the script in the documentation above is for pushing back to the same repo where Pipelines is running. If you want to push to a different repo, you can adjust the URL in the example to be the one of repo-B and use that URL in the push command (no need to change origin).

I hope this helps, please feel free to let me know if you have any questions.

Kind regards,  
Theodora

comments: author: Joseph Saliba
body: Hi,

This is a bit old now, but just pointing out that I was looking for a solution for the same problem.

The real problem is that the pipeline is fetching the repo, it's the docker image builder (another vm) that is doing that.

So far, the solutions I have run across are either using buildkit (not yet supported by bitbucket pipelines) or by passing the private and public key as variables and setting them in the .ssh dir of your user.


Tags: bitbucket-pipelines

bitbucket-cloud

cloud
Can I use one existing SSH key for two different computers?
Asked by Djordje Stojanovic:

The computer I used so far is in service, and since I need access to my work, I received another computer from the company to use. So I'm wondering if it's possible to use an existing SSH key from my bitbucket account on my current computer? Please, can you explain to me how?

<br />

Thanks in advance


Answers:
author: Martin Bayer _MoroSystems_ s_r_o__
body: Hi [@Djordje Stojanovic](/t5/user/viewprofilepage/user-id/2217919) yes you can. It would be safer to create new key and invalidate the old one in bitbucket configuration, but you can reuse it.

It is enough to copy private and public part of the key from previous computer to a new one.

Disk location should be ${home}/.ssh where ${home} depends on your operating system. For Linux systems it is /home/{username}/.ssh.

comments: author: Djordje Stojanovic
body: In that case, I will choose the safer option and create a new SSH key. Thank you for the answer [@Martin Bayer _MoroSystems_ s_r_o__](/t5/user/viewprofilepage/user-id/527698) .


author: Martin Bayer _MoroSystems_ s_r_o__
body: Good choice ?


Tags: bitbucket-cloud

cloud
Unreal and assets
Asked by frazer Nash:

Hello

Im working with a start up developers we want to set up somewhere to add all assets art, music, but we also want to hold our game in the same location. Unreal...so people not is the office can work on the code...Question is this possible with bitbucket. Frazer


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

These assets (art, music etc), are they part of your repositories and do you track changes in them with Git? Or do your repositories track changes only in source code, and you want to upload somewhere the assets as well?

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Sourcetree user login failure, sometimes
Asked by John Fetzik:

I have a user that is getting a user authentication failure when attempting to clone a repo from Bitbucket in Sourcetree on Windows 10.

The behavior is somewhat weird. On the Remote tab in Sourcetree they can see the repository list, but when they go to clone a repo they get an authentication error. The weird parts are as follows.

If we use a different Bitbucket username/password we can do a clone.

If we skip Sourcetree and use Git on the command line we get the same result. Again using a different Bitbucket username/password works.

I have tried all of the methods I could find online to remove the stored credentials. The authentication tab in Sourcetree, Windows credential Manager, deleting Sourcetree folders, etc. We have also tried multiple versions of Sourcetree, doing uninstalls in between.

It seems that Git is using different credentials not from Sourcetree that are incorrect/corrupted in some way.

Any ideas what else I might be able to try. Don't really want to change the users username or reimage their PC, as they have a lot of other dev tools set up that are working.


Answers:
author: Theodora Boudale
body: Hi John,

If the user's Bitbucket account has an email from a domain that has been verified as per [this doc](https://confluence.atlassian.com/cloud/verify-a-domain-for-your-organization-873871234.html), and [SAML](https://confluence.atlassian.com/cloud/saml-single-sign-on-943953302.html) is used for logging in to this account, then the account's password won't work for HTTPS authentication when cloning/pulling/pushing from/to Bitbucket.

In this case, the user can generate an app password for their Bitbucket Cloud account and use that instead of a password for purposes of cloning etc:

* <https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/>

I would suggest trying an app password anyway, for testing purposes, and if it works they can continue working with it if they want.

If you ask the user to leave a comment in this Community post (using a Community account with the same email as their Bitbucket Cloud account), I'll be able to see their email and confirm whether SAML is used for logging in to this account and if that's the cause for the issue.

If this is not the case, then we can investigate further. It would still be good to be able to talk with the user directly in the post here, instead of asking you to pass along suggestions and replies back and forth.

Kind regards,  
Theodora

comments: author: John Fetzik
body: Hello,

Thanks for the feedback.

We are currently using Atlassian Access or SAML at this time. We tried using an app password and that did not work.

I will ask the user to make a post for more direct communication.


author: John Fetzik
body: I have asked the user to post to this thread.


Tags: bitbucket-cloud

cloud

sourcetree

windows
How to include multiple customer pattern
Asked by Avinash Jain:

How to include multiple customer pattern in below -

[https://bitbucket.org/atlassian/git-secrets-scan/src/aa36a7923171fd5bcd296e043509302e7c66c602/README.md?at=master\&viewer=%24default](https://bitbucket.org/atlassian/git-secrets-scan/src/aa36a7923171fd5bcd296e043509302e7c66c602/README.md?at=master&viewer=%24default)


Answers:
author: Halyna Berezovska
body: [@Avinash Jain](/t5/user/viewprofilepage/user-id/4233693) you can put any string regular expression using the power of regex.

The regular expression can accept multiple variants, when you use syntax \| :

\`word1 \| word2\` , for example. Follow regex manuals <https://www.rexegg.com/regex-quickstart.html> and others and regex playground - we recommend <https://regex101.com/> , where you can check your regular expression.

So the multiplicity is implemented in regex itself.

Regards, Galyna


Tags: bitbucket-pipelines

cloud

git

permission

security
How to delete a project with no access to the repository?
Asked by kcwoodfield:

I worked for an organization for about a month. I was added to their Project and the repositories inside that Project.

It has been a few years now so I want to delete that Project however, I don't have access to those repositories. Also, the organization doesn't exist anymore.

When I try to delete the Project I get the following message:

* ***"You can't delete this project because it still contains repositories, which you don't have access to. Have your team delete or move the remaining repositories first."***

How do I remove myself from an abandoned Project?


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

Checking in our system, I can see that the Bitbucket Cloud account with the same email as your Community account has access to some workspaces. One of these workspaces is on a dormant state. Based on what I see, the attempt to delete it most likely timed out.

If you want, I can remove the dormant status so you can attempt the deletion one more time, please feel free to let me know.

Also, keep in mind that this workspace has some repos which will get deleted upon workspace deletion, so I would suggest transferring them or taking a backup prior to the deletion, if you need them.

I am not sure if the workspace I am talking about is the same one you are referring to. It most likely is, but if you can share the workspace ID then I can confirm.

Otherwise, I can still remove the dormant status since you are an admin, so that you attempt the deletion one more time.

Kind regards,  
Theodora


author: Hana Ku?erov?
body: Hi [@kcwoodfield](/t5/user/viewprofilepage/user-id/4232856) ,

welcome the Atlassian Community!

I think the only thing possible is to delete repositories, where you have admin access.

If there are repositories, which are not accessible for you, you won't be able to get rid of them and the project folder will stay.

Maybe you can try to contact official Atlassian support, describe them the situation and they will check it, but to be honest I don't think they will give you the access.

comments: author: Kevin Woodfield
body: Thanks.

I have deleted those repositories. I don't need access I just want to be removed from the Project.


author: Hana Ku?erov?
body: When you visit the page with all the workspaces available for you (Your profile and settings (click on profile avatar) -\> All workspaces), are you able to see action Leave next to this organization's workspace?


Tags: bitbucket-cloud

cloud
Not recerving password reset email
Asked by abhisheksinh.parmar:

Hi Team,

i am not getting my password reset email when i trying direct login without google or Microsoft in bitbucket.

Can you help me ASAP?

Regards,

Abhishek


Answers:
author: G subramanyam
body: Hi [@abhisheksinh.parmar](/t5/user/viewprofilepage/user-id/4231874) welcome to the Atlassian Community.

Your issue is something that Atlassian support team has to investigate and worked on. May I request you to reach them at: **<https://support.atlassian.com/contact>**with screen shots, URL and browser name please.

Alternatively, if you are using a **Jira Server edition** and not getting password reset email, then kindly reach Jira Server admin in your organization.

If my answer addressed your query, kindly upvote and click "accept answer".

comments: author: abhisheksinh.parmar
body: Thanks [@G subramanyam](/t5/user/viewprofilepage/user-id/3929184) i have raise a support ticket,


author: G subramanyam
body: Hi [@abhisheksinh.parmar](/t5/user/viewprofilepage/user-id/4231874) you may kindly select "accept answer", so members with this type of issues can quickly reach out to support team using the link.


author: abhisheksinh.parmar
body: Hi [@G subramanyam](/t5/user/viewprofilepage/user-id/3929184)

Issue has been resolved. Thanks for the help


author: G subramanyam
body: Glad to hear that. If you have some leisure time, please share the findings or root cause.