youngmon/atlassian-qna huggingface dataset:
restone branch
Asked by Mukhriddin:

I unknowingly deleted the dev and feature/payment_service_module branches. Ed is not visible in both branches local and remote and none of his commits are visible. How can I restore them?


Answers:
author: Patrik S
body: Hello [@Mukhriddin](/t5/user/viewprofilepage/user-id/5238271) and welcome to the Community!

The easiest way to restore a deleted branch is by looking at other clones of the repository in question (on your or your colleague's machines) to see if they have a backup of the branch. If this is the case, it may be easier to push the branch up to Bitbucket from the other copy of the repository that still has the branch.

However, if you don't have another clone that includes the deleted branch and if you have deleted the branch both locally and on the remote, you might still be able to recover it if you have the working copy of the repository where the branch was deleted. This is because we will need to find on the **reflog**of your local clone of the repository what was the last commit of that branch, so we can create a new branch pointing to that commit.

The following command can be used to find what was the last commit in the deleted branch. In this example, we are using branch **development** :

    git reflog  --no-abbrev | grep development

The output of the command should be similar to this :

    11bf4fd3d4e58285938e0fce801b2b216a5c0d7f4 HEAD@{0}: checkout: moving from development to master773677e7173488c64410af59e0c3287a24c54326 HEAD@{1}: checkout: moving from master to development

In this example, the reference log shows the last two moves for the **development** branch. The first line is checking out the branch master with the hash 1bf4fd3. The second line is when the repository moved from master to development, so this is the hash we are looking for.

Once the hash is found, you can use the **checkout** command to create a new branch pointing to that commit :

    git checkout -b <branch-name> <hash>

and your branch should be recreated.

We also have the following article with additional scenarios you might want to try in order to restore the deleted branch :

* <https://confluence.atlassian.com/bbkb/how-to-restore-a-deleted-branch-765757540.html>

Thank you, [@Mukhriddin](/t5/user/viewprofilepage/user-id/5238271) !

Patrik S


Tags: bitbucket-cloud

cloud
getting error when run bitbuket.yml file excute
Asked by Jay Khatri:

i am writing this scrpit fot connecting to ec2 server  

script:  
- apk add --no-cache openssh-client  
- eval $(ssh-agent -s)  
- echo "$awskey" \| ssh-add -  
- mkdir -p \~/.ssh  
- chmod 700 \~/.ssh

<br />

but at line 3 " echo "$awskey" \| ssh-add - " it give me error \> + echo "$awskey" \| ssh-add - Error loading key "(stdin)": error in libcrypto.

I already added a variable in the Repository settings.  

please give me solution  

Thanks,


Answers:
author: Theodora Boudale
body: Hi Jay and welcome to the community!

Pipelines does not currently support line breaks in environment variables and a private SSH key has line breaks. If you want to add a private SSH key as a variable you can base-64 encode it first and then add the base64-encoded private key in the variable. You can find more details about this here:

* <https://support.atlassian.com/bitbucket-cloud/docs/use-multiple-ssh-keys-in-your-pipeline/>

However, if you use only one SSH key in your pipeline, then instead of using a variable you can set up SSH keys from the **Repository settings \> SSH keys** page of the repo:

* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-pipelines-ssh-keys-on-macos/>
* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-pipelines-ssh-keys-on-windows/>
* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-pipelines-ssh-keys-on-linux/>

Kind regards,  
Theodora


author: Erez Maadani
body: Hi [@Jay Khatri](/t5/user/viewprofilepage/user-id/5238007)

This error is usually triggered upon missing newline or the opening and closing lines of the private key (the ones which start and end with "----"). Try the following solutions:

1. Try replacing \`- echo "$awskey" \| ssh-add -\` with \`- echo "${awskey}" \| ssh-add -\`
2. Try adding again the private key with all its lines, including "-----BEGIN OPENSSH PRIVATE KEY-----" and "-----END OPENSSH PRIVATE KEY-----"


Tags: bitbucket-cloud

cloud
netlify builds are failing on public repository
Asked by dnyaneshwar.m:

Hello Team,

We have one of the repository which is public and we are using netlify for site deployments.

But since we have IP restrictions enabled on bitbucket all the build pulls are failing with ip whitelisting error. Could you please check the behavior? IP restrictions should be only restricted to private repos and any public repos that we have should not have private repos.

Any workaround?


Answers:
author: Patrik S
body: Hello [@dnyaneshwar.m](/t5/user/viewprofilepage/user-id/5237983) , and welcome to the Community!

I see you have also opened a support ticket to report this issue and one of our support engineers is already working with you on that ticket. We recommend focusing the discussion on the support ticket to avoid any confusions that may arise from discussing the same issue in multiple places.

Once the ticket is closed, if you feel comfortable, feel free to share the solution with the rest of the community here!

Thank you, [@dnyaneshwar.m](/t5/user/viewprofilepage/user-id/5237983) !  
Patrik S

comments: author: dnyaneshwar.m
body: Sure


Tags: bitbucket-cloud

cloud
Prepending or Appending branch name in pull request title
Asked by Vivek Sharma:

Hi, We are using Bitbucket server v8.5.1 and our requirement is to have jira task name as part of pull request title. Hence, is there any way to prepend or append the feature branch name(e.g. feature/abcd-1234) as part of PR title. Thanks in advance.


Answers:
author: Adam Ahmed
body: It doesn't perfectly answer your question, but one thing you can do is add checks on the branch names and commit message such that they always include the related JIRA issue key. For example, you can use [branch permissions](https://confluence.atlassian.com/bitbucketserver/branch-permission-patterns-776639814.html) to disallow creating feature branches that don't follow a pattern like \`ABCD-\*\`).  
There is also the [Commit checker](https://confluence.atlassian.com/bitbucketserver/bitbucket-data-center-and-server-7-16-release-notes-1081348350.html#BitbucketDataCenterandServer7.16releasenotes-jiraissues) released in 7.16 for enforcing issue keys.  

If you do that, the default PR titles will have Jira keys in the name by default.  

Hope that helps!


Tags: bitbucket-server

server
How may I track changes of a single file using bitbucket?
Asked by Alain Ross:

I want to know when a specific piece of code in the file was added to depo.


Answers:
author: Patrik S
body: Hello [@Alain Ross](/t5/user/viewprofilepage/user-id/3368091) and thank you for reaching out to Atlassian Community!

If you would like to track the evolution of a range of lines in a file of your repository throughout the history, I would suggest using **git log**command in a local clone of the repository.

You will need to execute the command in your terminal inside the local clone of the repository:

```
git log --pretty=short -u -L 10,15:my_file_.txt
```

In this example, **git** will print all the commits that modified lines 10 through 15 in a file named my_file_.txt. It will also show the diff containing the changes that each commit introduced. With this information, you can go through that list of commits and diffs and find which one modified the piece of code you are interested in.

Hope that helps! Let me know in case you have any questions.

Thank you, [@Alain Ross](/t5/user/viewprofilepage/user-id/3368091) !

Patrik S


Tags: bitbucket-cloud

cloud
Migrate bitbucket
Asked by Vicente Martinez Navarro:

Hello,

Is it possible to change the bitbucket and bitbucket pipeline from one Atlassian account to another Atlassian Cloud account without losing data?

Thank you


Answers:
author: Aron Gombas _Midori_
body: It is possible to transfer the owner ship of repositories: <https://support.atlassian.com/bitbucket-cloud/docs/transfer-repository-ownership/>

And because pipelines are attached to repositories, those will be transferred to the new owner, too.

comments: author: Vicente Martinez Navarro
body: Thanks. I will try


Tags: bitbucket-cloud

cloud
Cloning repo using password in git clone command causes issue
Asked by Nabih Bawazir:

I'm using an AWS instance to deploy a code, my first step I to clone the code in AWS instance.  
The cloning request required me to input password, the password is successfully for login bitbucket website, but when I try to input password for cloning, it failed

\`\`\`  
nabih@aws9-1:\~$ git clone [https://USERNAME@bitbucket.org/company_name/user_service.git](https://Nabih_Bawazir@bitbucket.org/company_name/user_service.git)  
Cloning into 'user_service'...  
Password for '[https://USERNAME@bitbucket.org](https://Nabih_Bawazir@bitbucket.org)':  
\`\`\`  

After input password, I am use password that successfully login in bitbucket website, here's the error message  

\`\`\`  
remote: Login failed due to incorrect login credentials or method.  
remote: If you are unsure of which login details or login method to use, visit:  
remote: <https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/>  
fatal: Authentication failed for '<https://bitbucket.org/company_name/user_service.git/>'  
\`\`\`

What the possibility beside the wrong password?


Answers:
author: Patrik S
body: Hello [@Nabih Bawazir](/t5/user/viewprofilepage/user-id/5236445) ,

To authenticate git operation over HTTPS you will need to provide an [App Password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/), and not the account password (the password you use to login in the UI).

You can create an App Password following the instructions in [Create an App Password](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/) documentation. To clone the repository, the app password should have at least the **repository:read** scope.

Also, I removed your username from the question description to protect your privacy, as this is a public forum.

Thank you, [@Nabih Bawazir](/t5/user/viewprofilepage/user-id/5236445) !

Patrik S


author: Aron Gombas _Midori_
body: I don't know why the password is not accepted (assuming it is correct), but you could try the SSH-based clone. That will not ask for your password. (It is secured by using SSH keys.)

See: <https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/>


Tags: bitbucket-cloud

cloud
How to add restrictions on multiple branches like master, release, dev to branch?
Asked by Dhananjay Salunke:

How to add restrictions on multiple branches like master, release, dev to branch?


Answers:
author: Ulrich Kuhnhardt _IzymesCo_
body: Hello [@Dhananjay Salunke](/t5/user/viewprofilepage/user-id/5237035) - welcome to the community!

In Bitbucket cloud you can set up branch restrictions for any branch

* On [repository level](https://bitbucket.org/blog/take-control-with-branch-restrictions)
* OR if you have a similar branch structure for repositories in your project(s) configure branch restrictions on [project level](https://bitbucket.org/blog/maintain-code-quality-at-scale-with-project-level-branch-restrictions)

Hope that helps!

Best, Ulrich

// [Izymes](https://marketplace.atlassian.com/vendors/1210584/izymes-pty-ltd)


Tags: bitbucket-cloud

cloud
Error when trying to log in
Asked by Preston Morris_ Jr_:

Our Bitbucket logs in using Jira. Yesterday, I changed our JIRA instance to route traffic through a proxy. This made it easy to apply an SSL to our JIRA instance.

When I ran into this issue, I rebooted my Bitbucket into "Recovery Mode", so I'm able to log in as recovery_admin to administer the bitbucket server.

I BELIEVE the mechanism that allows bitbucket to log into JIRA is Application links. This is where I'm going to try and troubleshoot the authentication issue, but both JIRA and Bitbucket have application links pointing back to each other, and both say they're "Connected".

I've additionally removed the application links and re-added them. I started in Jira, and I need to authenticate with Bitbucket, I did, and then bitbucket needed to authenticate with Jira. It all went through fine, but I'm still not able to log into bitbucket with a Jira account.

This was working before I setup the proxy, so I don't anticipate version being a major issue, though I'll list them here:  

Jira: 8.18.1  
Bitbucket: 4.8.3

I should also mention that I was careful to ensure the link to jira didn't change. It's the same URL, same port, same everthing. Another thing is my confluence also logs in with jira accounts, and without any changes, it's continuing to log into jira.

I figure that either I'm looking in the wrong place, like maybe application links have nothing to do with bitbucket authenticating with JIRA, or something is making reference to the IP address of the server. When setting up the proxy, jira.domain.com needed to resolve to the proxy instead of the server, and the proxy is responsible for directing that traffic to the jira server. If something is making reference to the jira server directly, that might be the root of the issue. Or perhaps the proxy is blocking something.


Answers:
author: Preston Morris_ Jr_
body: I figured out my own problem. It's not an application link, it's a "User Directory" that I needed to update in Bitbucket. I updated it to reflect the proxy'd URL, and all is well now.


Tags: bitbucket-server

server
Bitbucket Server REST API build status missing fields(logs, artifacts, actions)
Asked by Sebastien Ashby:

Hi,  

I'm working with the following versions of the Atlassian products:

* Bamboo Server version 8.2.5 build 80211 - 22 Jul 22
* Bitbucket Server v7.21.5

And am using the Bitbucket REST API to populate(POST) the build status of commits.

* <https://docs.atlassian.com/bitbucket-server/rest/4.0.0/bitbucket-build-rest.html>
  * /rest/build-status/1.0/commits/{commitId}

The example json request representation is:

    {    "state": "SUCCESSFUL",    "key": "REPO-MASTER",    "name": "REPO-MASTER-42",    "url": "https://bamboo.example.com/browse/REPO-MASTER-42",    "description": "Changes by John Doe"}

Everything works fine for the json fields in the example representation.  
But I wish to provide links for the "Logs", "Artifacts" and possibly "Actions".  

Is this possible?  
What would be the name of the corresponding fields in the json request representation?  

![bitbucket_server_rest_api_logs_artifacts_actions.png](/t5/image/serverpage/image-id/261617i7F469A0D30A10FA1/image-size/large?v=v2&px=999 "bitbucket_server_rest_api_logs_artifacts_actions.png")


Answers:
author: Sebastien Ashby
body: Dug a bit and found these two links:

* <https://jira.atlassian.com/browse/BSERV-12946>
* <https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-rest-api-for-logs-and-artifacts/qaq-p/1789378>


Tags: bitbucket-server

rest-api

server
I can't use account password while clone repository
Asked by Nabih Bawazir:

What happen to me is similar with this [Git-clone-command-causes-issue](https://stackoverflow.com/questions/75613168/cloning-bitbucket-repo-using-password-in-git-clone-command-causes-issue)  
What I found is using HTTP Access Token using [Atlassian Tutorial](https://stackoverflow.com/questions/75613168/cloning-bitbucket-repo-using-password-in-git-clone-command-causes-issue) but it seems different version with today UI


Answers:
author: Theodora Boudale
body: Hi [@Nabih Bawazir](/t5/user/viewprofilepage/user-id/5236445) and welcome to the community!

The documentation provided in the StackOverflow post about HTTP Access Tokens is about Bitbucket Server / Data Center and it does not apply to Bitbucket Cloud.

In Bitbucket Cloud, you can use an app password (in combination with your Bitbucket username). You can generate it if you:

1. Open <https://bitbucket.org/> on your browser
2. Select the cog icon from the top right corner (next to your profile picture)
3. Select **Personal Bitbucket settings**
4. Select **App passwords**

This is the documentation for app passwords:

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

In Bitbucket Cloud, an account's password can be used only for logging in to the website from browser. If you want to clone, pull, or push to a repo via HTTPS, you can use your username with an app password for your account.

Please feel free to reach out if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Topics about creating branch issues
Asked by somjit pipit:

Hello, I have a problem to create branch as attached picture. Please tell me what is causing this problem? And when will I be able to use it?

\<screenshot removed\>


Answers:
author: Theodora Boudale
body: Hi [@somjit pipit](/t5/user/viewprofilepage/user-id/2478570),

Based on the screenshot you shared, it looks like you are having issues viewing the details of Compare branch.

Could you please do the following on your browser:

* Open Developer Tools
* Select the tab **Network**
* Load the page that gives you this error
* In the tab **Network**, select the request that gives a 5xx error
* In the **Headers** tab, there should be a field named **x-sentry-id**

Could you please provide the value for the **x-sentry-id**, so I can look it up in our system? That should give me some additional details on why the error occurs.

Just a heads up, I removed the screenshot from your post, as it shows details like workspace id and repo name, to protect your privacy.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
cloud bitbucket version
Asked by Admin Balluun:

I want to know the Bitbucket and Jira version


Answers:
author: Theodora Boudale
body: Hi [@Admin Balluun](/t5/user/viewprofilepage/user-id/5236390),

Jira Cloud and Bitbucket Cloud are not using any version of the Server products.

We don't have any official versions for Jira and Bitbucket Cloud, any updates are done through continuous integration and deployment.

Kind regards,  
Theodora


author: Ankit Anway
body: Hi Balluun,

Welcome to the community !!

What you are seeking is not clear from the question. But I am sharing the version details for Bitbucket \& JIRA.

Bitbucket URL : [bitbucket-download-archives](https://www.atlassian.com/software/bitbucket/download-archives)

JIRA URL : [jira-update](https://www.atlassian.com/software/jira/update)

Thanks,

Ankit \| Bitbucket Cloud

comments: author: Admin Balluun
body: Hi Ankit,

I need to know on what version of Jira and Bitbucket currently we are using


author: Admin Balluun
body: As we are using Cloud bitbucket and Jira


author: Admin Balluun
body: Please confirm me version of JIRA and Bitbucket tools of currently we are using


Tags: bitbucket-cloud

cloud
Git pull or push not working
Asked by Fatih Tasdemir:

Hi, when I try "git pull" or "git push" on command line, give error

error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error  
fatal: The remote end hung up unexpectedly


Answers:
author: Aron Gombas _Midori_
body: There was an incident, but by now it is (should be) fixed:

<https://bitbucket.status.atlassian.com/incidents/mn08j05ms7wx>


Tags: bitbucket-cloud

cloud

sourcetree
Where can i find my invoice for bitbucket
Asked by Bezawada Ashok:

I am only able to see the plan details in bitbucket. I want to download invoices for my bitbucket account for the last three months..   
Also how often are the invoices generated, is it monthly or quarterly?


Answers:
author: Aditya Verma
body: Hi [@Bezawada Ashok](/t5/user/viewprofilepage/user-id/5221246) ,

Welcome to the Community!

If you are a primary technical contact, you should be able to see invoices here -https://my.atlassian.com/billing/paidorders

Thanks,  
Aditya

comments: author: Bezawada Ashok
body: Hi [@Aditya Verma](/t5/user/viewprofilepage/user-id/620284)   

How do i know if i am the primary contact?

Thanks


author: Aditya Verma
body: Hi [@Bezawada Ashok](/t5/user/viewprofilepage/user-id/5221246) ,

Please check the screenshot on below page. Under licenses you can see who is the billing/technical contact for a product.

<https://confluence.atlassian.com/jirakb/how-do-i-add-a-technical-or-billing-contact-to-my-account-432800062.html>

Thanks,  
Aditya


author: Bezawada Ashok
body: Thanks. That helped.  
Also can you let me know how to find my invoices get generated monthly or quarterly.


author: Theodora Boudale
body: Hi [@Bezawada Ashok](/t5/user/viewprofilepage/user-id/5221246),

Invoices are generated monthly. I can see though that you are not a billing contact for your Bitbucket Cloud license, so you won't be able to view invoices at <https://my.atlassian.com/billing/paidorders>. Another admin of the workspace is listed as billing contact.

If you know who the billing contact is, you can ask them to add you as well following the steps in the documentation that Aditya provided.

If you don't know who it is, you can create a ticket with our Customer Advocate team and ask them to provide you with invoices and let you know who the billing contact is.

You can create a ticket via <https://support.atlassian.com/contact/#/>

* In **What can we help you with?** select **Billing, payments, and pricing**
* In **Select a topic** select **Finding invoices**

Please make sure to provide in the ticket the URL of your Bitbucket workspace that is on a paid plan.

If you have any questions, please feel free to reach out.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Staging in shared submodule deletes file
Asked by Horschig:

Heyho,

I set up a shared submodule, and whenever I stage a file in Sourcetree it shows that all files contents are deleted, so effectively Sourcetree states that I am staging a deleted file. When I unstage, the file is deleted. When I add the file via the terminal, it all works flawlessly. I think the tricky thing here is the shared submodule part, with which Sourcetree has trouble. While it could be that I am doing something wrong, I have the belief that Sourcetree is doing more than a simple 'git add' (as that works from the command line).

I set up the shared submodule as followed:

1. Clone the project that should serve as the shared submodule locally to some directory  
2. In the shared submodule, modify the local config of this project by adding 'worktree = ..' under \[core\]

For all projects sharing this submodule:

3. Add the submodule (this means, effectively I now have two checked out copies of that project)  
4. Delete the respective submodule folder in ./git/submodule/  
5. Delete the content of the submodule directory apart from the .git file  
6. Modify the .git in the submodule directory to point to the path of the project setup in 1)


Answers:
author: minnsey
body: Hi  

I think you summary is probably correct, we certainly don't test such a shared submodule setup.  

Can I ask why you do it like this rather than having the submodule available via a remote and each *parent* project simply adding it as a *standard* submodule from that remote?

comments: author: Horschig
body: Sure, that is because I do not want to have several different copies checked out. This facilitates working across projects. If I'd use the standard way, if I change a file in a submodule in one project, the file would not be changed in the respective submodule in all other projects. I would have to commit it first, and then pull in all my other projects. With a shared submodule, I change a file in one project, and the changes are 'automatically' applied to all projects sharing this same submodule.

I see that I posted this under questions, but I forgot to ask one. So here it is: Given my setup above and the problem I run into, is this a bug in Sourcetree?


author: minnsey
body: Possibly ;) Could you raise a ticket at <https://jira.atlassian.com>? Thanks


Tags: submodule