youngmon/atlassian-qna huggingface dataset:
Git push not working
Asked by Sankaran Nanjundan:

I tried sourcetree and local git to push the code .

Unfortunately i SAML password for bitbucket is not working

Looking for teh following things :

1. How to fix git global configuration setup in local for SAML based bitbucket

2. how to fix git global configuration using app password

3. How to fix source tree for mac using app password


Answers:
author: Theodora Boudale
body: Hi [@Sankaran Nanjundan](/t5/user/viewprofilepage/user-id/2932687),

The SAML SSO password can be used only for logging in to <https://bitbucket.org/> from browser. If you want to clone and push to repos from your machine with basic authentication via HTTPS, you can generate an app password and use that (instead of a password):

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

The recommended approach is to use a credential helper to store the app password, instead of saving it in plain text.

If you are using a Mac, then Keychain Access is commonly used as a credential helper and it is pre-installed on Mac. You can check if it is already used by Git as a credential helper by running the following commands on a terminal on your Mac:

```
git config --global credential.helper
git config --system credential.helper
```

If the output of any of these commands is **osxkeychain**, then Keychain Access is already used as a credential helper for Git. If it isn't already set, you can set it with the command

```
git config -?global credential.helper osxkeychain
```

(applies to your user on the system)

or

```
git config -?system credential.helper osxkeychain
```

(applies to all users on the system)

The first time you try to clone or push to a Bitbucket Cloud repo via HTTPS, you will get asked to give a password. Enter the app password, and it should then get saved in the credential helper. Next time you pull or push to a Bitbucket Cloud repo, the saved app password should be used.

SourceTree also works with username and app password for HTTPS authentication. In SourceTree for MacOS, you can go to **Accounts \>\> Add...** and add your account with **Auth type: Basic** , **Protocol: HTTPS,** and provide username and an app password (in the Password field). Apart from Repositories Read - Write, make sure that the app password also has Account: Read permissions so it can be used when adding your account to SourceTree.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
How can I delete git notes from my commit history?
Asked by Furkan Elibol:

Hello,

When I looked at my commit graph, I saw some commits that are done by semantic-release-bot.

![Screenshot 2023-03-14 at 12.36.27.png](https://community.atlassian.com/t5/image/serverpage/image-id/245450i7C98B4983B07E778/image-size/large?v=v2&px=999 "Screenshot 2023-03-14 at 12.36.27.png")

I want to delete all these "git notes add" commits, but I couldn't find any way to access and remove them

* I checked my local git log, but these commits are not shown there
* I checked my local refs, but there is no ref named refs/notes

How can I do it?


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

Please run the following commands in your clone of the repo:

```
git fetch --all
git branch --all
```

Does the output of **git branch --all** show this branch in your remote branches?

If so, and if the branch does not exist locally, you can checkout the branch locally with the command

```
git checkout -b branch-name origin/branch-name
```

where **branch-name** replace with the name of your branch and **origin** replace with the name of the branch's remote, if it is different.

<br />

Before you proceed with removing any commits, I would strongly recommend taking a backup of the repo as the process includes destructive operations. If your Bitbucket Cloud repo has all the branches and changes you have locally, you can take a backup by cloning with the mirror flag:

```
git clone --mirror repo_url
```

If the commits you want to remove are the last ones on that branch, after you checkout out this specific branch you can use

```
git reset --soft HEAD~1
```

where **1** replace with the number of commits you want to remove. E.g. **git reset --soft HEAD\~3** will remove the last 3 commits on the branch that is checked out.

If you have made other commits that you want to keep, and the commits you want to delete are not the last ones on that branch, you can use an interactive rebase to remove these commits. You can see more details in the following post in StackOverflow:

<https://stackoverflow.com/a/42522493>

In both cases, you will need to force-push your changes to the remote repo (push with the -f flag). Please keep in mind that pushing with the -f option will overwrite the commits on the remote (which is why it's important to have a backup in case anything goes wrong).

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Bitbucket Pipelines import steps from another repo pipelines
Asked by Roel Janken:

I recently discovered some new features in development and hopefully released soon.

In the [\`pipelines-schema.json\`](https://bitbucket.org/atlassianlabs/atlascode/src/main/resources/schemas/pipelines-schema.json?) which you can view when using VS Code, there is mentioning of an "import" setting a "Location to import pipelines config from"  

```
...
    "import": {
      "type": "object",
      "properties": {
        "import": {
          "type": "string",
          "pattern": "\\S:\\S",
          "title": "Location to import pipelines config from",
          "description": "The import needs to match the following format: {repo-slug|repo-uuid}:{tag|branch-name}"
        }
      },
...
```

In the \`bitbucket-pipelines.yml\` you want to use as a source to import from, you need to set a property \`export: true\` on the root level, according to [the JSON Schema](https://bitbucket.org/atlassianlabs/atlascode/src/main/resources/schemas/pipelines-schema.json?)  
Unfortunately I can not get it to work yet but I am looking forward to a feature to be able to use another pipelines as a template or library.  
Does anybody have any experience yet or looked into as well?


Answers:
author: Patrik S
body: Hello [@Roel Janken](/t5/user/viewprofilepage/user-id/4264946) ,

Thank you for reaching out to the Community!

Our development team is working on functionality that will allow users to share the yml configs in Bitbucket Pipeline. This feature is currently being tracked in the following ticket :

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

The implementation of this feature is already in progress, but we cannot provide an ETA on when it will be completed. The best way to stay tuned for any update regarding the implementation of that functionality is to add yourself as a watcher in that ticket, so you will receive first-hand updates whenever there's any progress. Feel free to also add your vote and comments there so it helps give it traction.

Thank you, [@Roel Janken](/t5/user/viewprofilepage/user-id/4264946) !

Patrik S

comments: author: Roel Janken
body: Thanks Patrik for you answer.   
I just added myself as a watcher in mentioned ticket.


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
Set Personal SSH Key on Linux (and Mac) guide error
Asked by Gabi Davar:

Hi,

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

creates an SSH key using \`-f\` under user's home directory:

```
ssh-keygen -t ed25519 -b 4096 -C "{username@emaildomain.com}" -f {ssh-key-name}
```

but the ssh configuration snippet assumes the key was generated under ./ssh :

```
Host bitbucket.org
    AddKeysToAgent yes 
    IdentityFile ~/.ssh/{ssh-key-name}

```

Unless I'm missing some magic behind the scenes the guide only works since the key was added to the ssh-agent.

It would seem correct and more secure to modify the guide to generate the key under \~/.ssh (instead of \~).

Thanks!

Hi Peter,

Thank you for your quick answer.

I don't see anything in the above man page which suggests ssh-add copies keys to \~/.ssh. It only states that if no files are given the certain default are used.

It is easily shown when tested:

```

$ ssh-keygen -t ed25519 -b 4096 -C "XXXXXXXXXXXXX" -f test-key
Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in test-key
Your public key has been saved in test-key.pub
The key fingerprint is:
SHA256:9hRqgtxVpnZvjXd4GAJPtFqvDhd16PyoVphQd77skko XXXXXXXX.com
The key's randomart image is:
+--[ED25519 256]--+
| +.o |
| + +.....|
| + o.=.+o.|
| . o o o.= O =.|
| o o S o.=oX +|
| + o .o+.B |
| oEo.+ .|
| .+.+ . |
| o+ . |
+----[SHA256]-----+
$ ls test-key*
test-key test-key.pub
$ ls ~/.ssh/test-key*
ls: cannot access '/home/XXXXX/.ssh/test-key*': No such file or directory
$ ssh-add test-key
Identity added: test-key (XXXXXX.com)
$ ls ~/.ssh/test-key*
ls: cannot access '/home/XXXXX/.ssh/test-key*': No such file or directory

```


Answers:
author: Peter Van de Voorde
body: Hi [@Gabi Davar](/t5/user/viewprofilepage/user-id/5169305) ,  

First off: welcome to the Atlassian Community.   

If I read the guide correctly this command:

```
`ssh-add ~/{ssh-key-name}`
```

Actually creates the different files under \~/.ssh/  

As explained here: <https://linux.die.net/man/1/ssh-add>  

And that's why that command works as far as I know.  

If you feel there is still an error I would suggest using the "Provide Feedback about this article" link at the bottom of the article. That should send your feedback directly to the right team.  

I hope that helps.  

Cheers,  
Peter


Tags: bitbucket-cloud

cloud
detected dubious ownership in repository
Asked by Eicke Felipe:

After upgrading bitbucket from 7 to 8.8.2 we are seeing the following error:

git cat-file -t refs/heads/master:' exited with code 128 saying: fatal: detected dubious ownership in repository at '/data/repositories/1' To add an exception for this directory, call: git config --global --add safe.directory /data/repositories/1 {#toc-hId--491805450}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

We still see the error even after adding the safe.directory.

# git config --global --list  
safe.directory=/data/repositories/1  
safe.directory=\*


Answers:
author: Christian Glockner
body: Hi,

Probably the /data/repositories/1 directory has a different owner than the user that Bitbucket Server is running with. You need to ensure all directories under /data/repositories have an owner that matches the user Bitbucket Server is running as.

Cheers,

Christian  
Premier Support Engineer  
Atlassian

comments: author: Eicke Felipe
body: Thank you! We fixed that exactly as you described.


author: venkatesh vp
body: Thank you! changing the ownership of the repo folder with instance owner fixed the issue. The error on the UI was misguiding and your solution fixed the issue that I had.


Tags: bitbucket-server

git

server
Does the BitBucket Free level support merge checks and repository hooks?
Asked by Yaniv Brener:

I am looking to create a Pre-Receive and/or RepositoryMergeCheck hook to run on a repository and block a merge to master branch if an error is thrown. I am reading all the tutorials and it seems like I should have a section called "Merge Checks" in my Repository Settings and an ability to add a "Custom" check, or a section called "Hooks" where I can add these. Not able to find them anywhere.

This is the tutorial link:

<https://developer.atlassian.com/server/bitbucket/how-tos/hooks-merge-checks-guide/>

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


Answers:
author: Ulrich Kuhnhardt _IzymesCo_
body: Hello Yaniv,

Welcome to the community.

The document you're referring to is Bitbucket **server** only.

For Bitbucket cloud no such hook or merge check exists.

The app developer community has been passionately communicating this missing feature to the Atlassian Bitbucket team:

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

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

Please vote and watch these tickets.

We have come across the same problem when we created [Workzone for Bitbucket Cloud.](https://marketplace.atlassian.com/apps/1211303/workzone-pullrequest-workflow?hosting=cloud&tab=overview) The app works around this by taking control over when the PR is ready to merge by checking bitbucket merge restrictions AND merge checks configured in the app.

Hope that helps!

Best, Ulrich

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

comments: author: Yaniv Brener
body: Hi Ulrich, thanks for the response! That makes a lot of sense and I added my votes - would definitely like this feature.

Looking at Workzone, I see the usefulness of it to automate some merging \& other behavior, but as far as I can tell, it doesn't support custom merge conditions/commands, correct?

Like running a particular git diff command, or a Django migration check like \`python ./manage.py makemigrations --dry-run\`, and blocking the code merge if failure...


author: Ulrich Kuhnhardt _IzymesCo_
body: Thanks for your feedback, Yaniv.

I understand that you would like to add custom merge conditions and commands.

Have you thought of adding a [Bitbucket pipeline](https://support.atlassian.com/bitbucket-cloud/docs/what-are-pipes/) or [Bitbucket pipeline runner](https://support.atlassian.com/bitbucket-cloud/docs/runners/) for the PR source branch and have Bitbucket or Workzone control the result of the pipeline runner outcome, i.e. check for successful builds?


author: Yaniv Brener
body: I think that's where I'm landing, I'll be looking into pipelines. Thanks!!


Tags: bitbucket-cloud

cloud
Can not clone repo via SSH because of SSH key password
Asked by Vladim?r ?amaj:

I have an account which does not have any SSH key (as I see in personal settings) set. There are few repositories which I have access to. One of them I can clone via SSH but other one I can not. It always require ssh key password.

In second repository I have a role admin. Dont understand how is it possbile if there is no key and how is it possible that I can clone other repositories without any passwords.

Can somebody tell me what could be the problem? Thank you.


Answers:
author: Erez Maadani
body: Hey [@vladimir_camaj](/t5/user/viewprofilepage/user-id/5168882)

Check your repo(s) access keys section, under Repository Settings -\> Security -\> Access Keys.

You might have ssh key installed which match the public keys in the Access keys.

As your computer can have multiple ssh keys, one might requires a passphrase which is why you see the request for ssh key password.

comments: author: Vladim?r ?amaj
body: There is no key. There is a button add key.


author: Vladim?r ?amaj
body: But the same is in repository which I can clone.


author: Vladim?r ?amaj
body: The error message says\>   
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.  
fatal: Could not read from remote repository.  

What it means "make sure you are authenticated"?


author: Erez Maadani
body: It means that if the repo exists and you have access to see it, your authentication has probably failed.

regarding your original issue, run the command

    git remote -v

in both repos and see if in both repos, the remote urls use the ssh prefix.


author: Vladim?r ?amaj
body: Its little weird. I need to clone via https but need to join repository with correct account. The problem was wrong account.

Thank you.


Tags: bitbucket-cloud

cloud
Is it possible to copy/clone a repository within the workspace in Bit bucket cloud version??
Asked by Srikanth Vemuluri:

Hello Team,  

We want to copy/clone a repository to create a new one with the same existing code and branches. Is it possible to do so in Bit bucket cloud version??   
If so please let me know the steps  

Thanks,  
Srikanth Vemuluri


Answers:
author: Patrik S
body: Hello [@Srikanth Vemuluri](/t5/user/viewprofilepage/user-id/4636631) ,

Thank you for reaching out to the Community!

Yes, it's definitely possible to create a copy of your repository within the same workspace, and I would personally suggest using the [Import repository feature](https://support.atlassian.com/bitbucket-cloud/docs/import-a-repository/). Importing a repository will essentially clone the source repository and save its content to a destination repository. If the source and destination repositories are in the same workspace, this can be considered as a "copy" repository operation.

To start the process of importing a repository you can follow the below steps :

1. Access the workspace and in the top navigation bar click on **Create \>** select **Repository**from the dropdown menu.

2. Click **Import repository** (top right) from the **Create a new repository** page.

3. Select the **Source** of the code you want to import.

4. Provide the **URL** of the source repository (the repo to be copied) - e.g. <https://bitbucket.org/>\<workspace\>/\<repo_slug\>

5. If the source repository is private you will need to check the option **Requires authorization** and provide the credentials for authentication. These credentials must have access to the repository.  
   **Username** : your Bitbucket username (not the e-mail address). You can find the username under your [account's personal settings](https://bitbucket.org/account/settings/).  
   **Password** : you need to provide an [App Password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) (not an account password) with the required privileges (for the import *repository:read* should be enough). Instructions on how to create an app password are outlined in [this documentation](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)
6. Select the **Workspace** for the new repository.
7. Select an existing **Project** or create a new one.
8. Enter a **Name** for your new repository.

9. Uncheck **This is a private repository** if you want the repository to be public.

10. Expand **Advanced settings** and fill out the rest of the page if necessary.

11. Press **Import repository**.

Once you click on **Import repository**bitbucket will internally clone the source repository and save it to a new repository under the workspace and project you have selected above. The source repository is left intact.

Hope that helps to address your questions! In case you run into any issues, please let us know.

Thank you, [@Srikanth Vemuluri](/t5/user/viewprofilepage/user-id/4636631) !

Patrik S


Tags: bitbucket-cloud

cloud
Helm repository
Asked by S?bastien Boulet:

Hi,

Following this question: <https://community.atlassian.com/t5/Bitbucket-questions/Helm-repository/qaq-p/1022537> (I can't answer on this page)

Solutions provided above aren't working, does someone have a trick to use a private bitbucket (cloud) repo as helm repo?

Best regards,


Answers:
author: Patrik S
body: Hello [@S?bastien Boulet](/t5/user/viewprofilepage/user-id/5117933) ,

Welcome to Atlassian Community!

The users in the thread you linked seem to have resolved the issue by using the following syntax in the helm command :

```
helm repo add {REPONAME} https://api.bitbucket.org/2.0/repositories/<workspace>/<repo-slug>/src/master/ --username {BB_USERNAME} --password {APP-PASSWORD}
```

Where the credentials users for authentication are the following :

**BB_USERNAME** : your Bitbucket username (not the e-mail address). You can find the username under your [account's personal settings](https://bitbucket.org/account/settings/).  
**APP-PASSWORD** : you'll need to provide an [App Password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) (not the account password you use to login into the UI) with the required permissions. Instructions on how to create an app password are outlined in [this documentation.](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)

You can try using the syntax and let us know how it goes. In case you are still facing issues, we kindly ask you to share the full output of the log you are receiving with the error. Please make sure to sanitize any sensitive information from the logs before sharing it with us here.

Thank you, [@S?bastien Boulet](/t5/user/viewprofilepage/user-id/5117933) !

Patrik S


Tags: bitbucket-cloud

cloud
How to get the list of scopes of an App-password?
Asked by Mohammed Muthahhar:

I want to get the list of scopes of an app-password to check whether the needed scopes are given to the specific app-password.   
I tried the a curl which was mentioned in stackOverflow

    curl -sS -f -I -u <username>:<app_password> https://api.bitbucket.org/ | grep ^x-oauth-scopes: | cut -d' ' -f2- | tr -d "[:space:]" | tr ',' '\n'

but it gives some error as   
\`Error while importing Curl: Only the URL can be provided without an option preceding it. All other inputs must be specified via options.\`  
in postman


Answers:
author: Ben
body: Hi Mohammed,

That is not a valid API endpoint. Unfortunately, there is no visibility of App Passwords in our API or their properties as this is considered sensitive data.

An App Password has its scope configured a single time and this cannot be edited, if you wish to modify scope - I would suggest deleting your App Password, creating a new one and taking note of the scope that you have defined.

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Mohammed Muthahhar
body: Thanks Ben,  

But I am in a need of a way to check the scopes of a given App-password to verify that the expected scopes are given to that App-passwrd


author: Ben
body: Hey Mohammed,

The API reference you have shared relates to OAuth scopes via access tokens, this is unrelated to the scopes configured on an App Password.

Unfortunately, you will be unable to gain the scope information on a current App Password as these are unable to be viewed/edited once they are created.

I have raised a feature request on your behalf to our developers to improve this, however - feel free to "Watch" to receive updates and "Vote" for it to increase its visibility with regard to customer demand:  
<https://jira.atlassian.com/browse/BCLOUD-22540>

Cheers!

- Ben (Bitbucket Cloud Support)


author: Mohammed Muthahhar
body: Thanks Ben..


Tags: bitbucket-cloud

cloud