youngmon/atlassian-qna huggingface dataset:
How to trigger a pipeline in a repo with a webbook that is inside another one?
Asked by Demba Diack:

I have a main repository witch have multiple submodules, and one pipeline in it.

the goal is to run the pipeline in the main repository when ever there is a change in the submodules, with the submodules name maybe as a parameter.

is there a way to do that in bitbucket?

thank you!


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

1. What kind of pipeline do you have in the main repository? Is it the default one? Is it defined to run on a certain branch or a tag? Or is it a custom pipeline?  

2. When you make changes in a submodule, do you push these changes to the main repo as well so that it points to the newest commit of the submodule?  

3. Do you use the source code of the submodules in the pipelines builds than run in the main repo?

<br />

In case you have a pipeline running e.g. on master branch of the main repo, if you push the submodule update to master branch of the main repo, then the pipeline will get triggered.

It is also possible to configure a webhook in a submodule repo that runs on every push to the submodule, sends a request to your server, and you can then trigger the pipeline in the main repo with an API call:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-pipelines-post>

Another thing you could do is have another pipeline in each submodule (e.g. the default pipeline that runs on every push to a submodule) and have that pipeline trigger the pipeline of the main repo using the following pipe:

* <https://bitbucket.org/atlassian/trigger-pipeline/src/master/>

Please keep in mind though that if you don't push the submodule update to the main repo, the main repo will point to an earlier commit of the submodule.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

webhook
trigger an action when repo is forked?
Asked by Max DeCurtins:

I would like to trigger an action when a repo is forked, e.g. when I fork Repo A, I would like to trigger a change to the repository settings on the fork, Repo B.

For example, Bitbucket currently (and very wrongly) assumes that PRs in repos that were forked from an upstream, should target the upstream by default. There is currently no way to change this.

Since there is no way to change this and no merge check available based on the target repo, my workaround is to create a default pull request task on PRs that basically says "CHECK THE TARGET REPO" and then have a merge check for unresolved PR tasks.

What I'd like to do is to have this default pull request task created (and the corresponding merge check enabled) every time the upstream repo is forked.

Better yet, is there a way to create a set of repository settings that is automatically applied to each repo that is forked from the upstream?


Answers:
author: Theodora Boudale
body: Hi Max,

You could use a [webhook](https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/) with trigger **Repository : Fork** for this purpose. With such a webhook, Bitbucket will send a request to a server of yours every time the repo is forked, and you can then run an API call on your server in order to update certain settings of the fork repo.

This is possible for settings that can be updated via our API. E.g. it is possible to create branch permissions via API:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-branch-restrictions/#api-repositories-workspace-repo-slug-branch-restrictions-post>

However, I'm afraid that it is not possible to create default tasks via API. We have a feature request for providing an API for PR tasks: <https://jira.atlassian.com/browse/BCLOUD-16682> Until this is implemented, default tasks need to be created manually from the Repository settings.

We also have a feature request for allowing users to set the default target repository for forks <https://jira.atlassian.com/browse/BCLOUD-20010> I would encourage you to add your vote and feedback to that feature request if that's something you'd be interested in, as this helps our product managers better understand the demand for features.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
JWT format is invalid when /installed is called when reinstalling a Bitbucket app
Asked by Paul Woolley:

(Cross posted [here](https://community.developer.atlassian.com/t/jwt-format-is-invalid-when-installed-is-called-when-reinstalling-a-bitbucket-app/59747?u=pwoolley2015) too)

**Problem:**

I am seeing a JWT format error when re-installing a Bitbucket connect app:

```
{} Authentication verification error (401): Invalid JWT: Unexpected token m in JSON at position 0
```

**To reproduce:**

1. Create, run and install the sample Bitbucket connect app according to the "getting started" guide at <https://developer.atlassian.com/cloud/bitbucket/getting-started/>
2. Re-install the app by re-visiting the installation link from step 9 of the "getting started" guide.

**Expected:**

The application is re-installed without error.

**Actual:**

The call to "/installed" results in a 401 error being thrown:

```
{} Authentication verification error (401): Invalid JWT: Unexpected token m in JSON at position 0
POST /installed 401 33234.738 ms - 53
```

**Notes:**

Looking at the incoming request, I can see the Authorisation header looks like this:

```
Authorization: JWT b'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAve2I2YzRiNzcwLWZjMDgtNDcxMS05NTdkLTU2MGExMzU4YjM4ZH0vZXhhbXBsZS1hcHAtMTIzNDU2IiwiZXhwIjoxNjU3MzAwMDg0LCJpYXQiOjE2NTcyOTY0ODQsInFzaCI6IjRhMmUxZGU4Y2E3NGU2Y2FmZTg4NjJkMzMyZmEzYWM3YThlNTFlNjkyYmM2ZDc5OGVhNGRmZWRjMTQ5NDhiZjQiLCJhdWQiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAve2I2YzRiNzcwLWZjMDgtNDcxMS05NTdkLTU2MGExMzU4YjM4ZH0vZXhhbXBsZS1hcHAtMTIzNDU2In0.PLgvhYcfdObBX6eEbxHzJxoajeNcjCaJBuGGdwtlzjQ'
```

Notice that the JWT starts with **b'** and also ends with a single quote. This is causing an error in the "atlassian-jwt/dist/lib/jwt.js" module when decoding the JWT.

If you remove the leading **b'** and trailing quote then the JWT looks correct. Something on the Atlassian/Bitbucket side seems to be generating wrapped/invalid JWTs when making that "/installed" API call.


Answers:
author: Paul Woolley
body: This issue has now been resolved after Atlassian applied a fix on their side.

Also see here: <https://community.developer.atlassian.com/t/jwt-format-is-invalid-when-installed-is-called-when-reinstalling-a-bitbucket-app/59747/1>


Tags: bitbucket-cloud

cloud
Pipeline needs to access multiple repos
Asked by binjie zhao:

Hi

We have a pipeline that needs to clone multiple common module repos. I followed this article: <https://bitbucket.org/blog/cloning-another-bitbucket-repository-in-bitbucket-pipelines>

However, when trying to add the public ssh key to the target repo as access key, I got following error:

\`Someone has already added that SSH key to another account.\`

I can't find where the keys are added. I did some research and came across this discussion: <https://community.atlassian.com/t5/Bitbucket-questions/Problem-quot-Someone-has-already-added-that-key-as-an-access-key/qaq-p/1851681>  

Hence posting a question here. Atlassian support, can you help please?

Many thanks.


Answers:
author: Mark C
body: Hi [@binjie zhao](/t5/user/viewprofilepage/user-id/4983063)

Welcome to the community.

Usually, the error indicates the public SSH key you're trying to add is added to your Bitbucket Cloud account's SSH keys. - <https://bitbucket.org/account/settings/ssh-keys/>  
For this, if you followed [this guide here](https://bitbucket.org/blog/cloning-another-bitbucket-repository-in-bitbucket-pipelines), you won't need to add the public key under your [account SSH keys](https://bitbucket.org/account/settings/ssh-keys/).

You'll just need to add it as an access key in your repositories.

If the public SSH key is added to your account's SSH keys, would it be possible for you to remove it there?  
Once done, add it to your repositories' access key.

Hope it helps and let me know how it goes.

Regards,  
Mark C

comments: author: binjie zhao
body: Hi Mark

Thanks for your reply.

The public SSH isn't added to my account with Atlassian. That's where the confusion is from. I have no idea where it is added. I think the folks were discussing about this issue here too:

<https://community.atlassian.com/t5/Bitbucket-questions/Problem-quot-Someone-has-already-added-that-key-as-an-access-key/qaq-p/1851681>

Regards,

Binjie


author: Mark C
body: Hi [@binjie zhao](/t5/user/viewprofilepage/user-id/4983063)  

Thanks for that information.  

So that we can investigate the issue further, I went ahead and created a support ticket for this.  

You should be able to receive an email notification about it.  
Let's continue our discussion there.  

Regards,  
Mark C


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
"load more commits" always fails in branch view
Asked by Max DeCurtins:

When I click on a branch in my repo to view it in Bitbucket Cloud, and I try to load more commits, I constantly get the "something went wrong - try again" error, and it never loads more commits in that branch.

Anyone else experiencing this? I searched for a BCLOUD Jira issue for this and haven't found anything. There are tickets for PR commit/diff views, but I'm talking about the branch view.

Thanks.


Answers:
author: Mark C
body: Hi [@Max DeCurtins](/t5/user/viewprofilepage/user-id/4143354),

Thank you for reaching out to the community and for reporting this to us.

I could also replicate the same issue on my end.  
For this, I went ahead and created a bug ticket for it that can be located through this link. - <https://jira.atlassian.com/browse/BCLOUD-22007>  
You can watch and click the "This affects my team" button so that you'll be notified of any updates from our team when the bug is fixed.

Do let me know if you have further questions that I can help with.

Regards,  
Mark C


Tags: bitbucket-cloud

cloud
SourceTree 2.0 is horribly slow on startup Windows 10
Asked by sjamesmccarthy:

Win10 build, 32GB RAM, i7, 7 repos and it takes 12 seconds to load. Does this seem horribly slow to anyone else? I have poked around the options and disabled many in hopes of improvement but have no luck.

Any suggestions would be helpful.


Answers:
author: minnsey
body: Hi,

That does sound excessively long. SourceTree replaces calls to git.exe with calls into libgit2. In the vast majority of cases libgit2 is faster than git.exe on windows. However it is possible that certain 'shapes' of repository, size, number of commits, branches, stashes etc, may effect this rule of thumb.  

You can try by backing up and removing your %localappdata%\\Atlassian\\Bookmarks.xml and OpenTabs.xml files. This will remove your bookmarks at which point we would, obviously, expect SourceTree to start quickly you could then re-add your 7 bookmarks one at a time. This should help identify if there is a particual repository/bookmark that causes the slowness.

<br />

The SourceTree team would be very interested to understand and ivestigate this issue if you were able to identify the source.

comments: author: sjamesmccarthy
body: Hi Michael,

I spent some time trying your suggestions as well as talking about the slowness with another sourcetree user (mac though). We came to the conclusion that my repos may be large and are simply the reason. My repos were just about 1GB in size total. If sourcetree scans these for updates each time the app opens, as it appears it does, it going to cost me in load-time. I pruned a few of my repos and was able to cut the load time in half. On my desktop I can load everything in 3 seconds now and on my tablet 5 but one is an i7, the other an Intel m.

I understand loading status updates is important, but perhaps only updating the statues of the repos of the default "folder" could be a way to speed things up. Or, a preference option to disable it or check it onLoad.

The rest of the app is quick. It's just that initial load time which unfortunately gives the app an over all bad first impression.

Oh, also, I noticed on the windows build that if one tab is open you can't click the red x to close it but can press ctrl-w. As a user, I am expecting to do both. Just something I noticed.

Okay, now to get the SSH stuff working.


Tags: windows
SourceTree git rebase root
Asked by soy:

I want to run "git rebase -i --root"  
Where is that function?


Answers:
author: bgannin
body: In the menu: *Repository -\> Interactive Rebase...*

If our workflow isn't sufficient then you can add that as a custom action in Preferences to run.

Cheers,

Brian Ganninger  
Senior Mac Developer, SourceTree

comments: author: soy
body: I didn't know custom action.  
It's all settled.  
thank you!
Unable to install SourceTree 2.0.20.1 via deployment
Asked by Kathleen Splaine:

When I try to install SourceTree 2.0.20.1 via KACE I get a an error "Failed to extract file". I am able to install manually without any issues however I need to push this out multiple users so manual installation isn't an option. It appears to be a 7-Zip error.![ST.gif](/t5/image/serverpage/image-id/1620i3C846C5CB50C96AA/image-size/large?v=v2&px=999 "ST.gif")


Answers:
author: Ana Retamal
body: Hi Kathleen! This could be related to a couple of bugs that were already reported at [SRCTREEWIN-6890](https://jira.atlassian.com/browse/SRCTREEWIN-6890) and [SRCTREEWIN-6886](https://jira.atlassian.com/browse/SRCTREEWIN-6886). As a workaround you can use the 1.9.10.0 install until this gets fixed, it can be downloaded from <https://downloads.atlassian.com/software/sourcetree/windows/SourceTreeSetup_1.9.10.0.exe>

Let us know if this solved the issue for you!

Regards,

Ana

comments: author: Kathleen Splaine
body: Hi Anna,

<br />

Thank for your response. Most of our users are on 1.9.10.0 but we received an email to upgrade to 2.0.20.1 based off a security advisory for versions prior to 2.0.20.1. Are we okay to stay at 1.9.10.0?

Thanks,

Kathy


author: Ana Retamal
body: Hi Kathleen,

Regarding the security advisory, the fix has only been applied to versions 2.0 onwards so from a security standpoint our recommendation is that every user upgrades. However, in your message you mentioned that manual installation is not an option for you, in that case you'll need to consider how you want to proceed.

Apart from that, keep in mind that the only officially supported method is the individual installation.

Let me know if you have any other questions!

Regards,

Ana
How to embed revision or release number within a file?
Asked by Jo?o Ferreira:

As you may know, browsers will cache the old JS and CSS files, instead of updating them, as we upload our new version of the project into the server. This leads to errors on the client-side, forcing them to hard-refresh the browser.

A [way to overcome this problem](https://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files) is for instance adding ?\[version\] at the end of the file as we call it:

```
<script type="text/javascript" src="myfile.js?1500"></script>
```

Is there a way to do it automatically with SourceTree, after a commit or a tag realease? For example:

```
<script type="text/javascript" src="myfile.js?$$REVISION$$"></script>
```

Thank you in advance


Answers:
author: bgannin
body: There isn't something specifically like this in SourceTree and I don't know when there will be (although voting for a ticket on replacement values is a good idea, or filing if there's not one)

That said, you should be able to accomplish something like this using [pre or post commit hooks in git](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).

Cheers,

Brian Ganninger  
Senior Mac Developer, SourceTree


Tags: revision

tag
Where is SourceTree.exe with 2.0?
Asked by Edwon:

I just upgraded to 2.0 and now I can't find SourceTree.exe

I want to know the location of the .exe because I am opening up sourcetree from a bash file


Answers:
author: Edwon
body: Found it, for anyone curious, it has apparently moved into your user/AppData/ folder

So in my bash script, it looks like this:

SET SourceTreePath="%USERPROFILE%/AppData/Local/SourceTree/app-2.0.20.1/SourceTree.exe"

comments: author: Shubhzgang
body: Thanks!
What is git thinking?
Asked by Gibran Shah:

I don't understand what git is thinking sometimes. In SourceTree, I pulled the latest code from the repository with rebase selected, it told me it couldn't apply a patch, and to resolve the issue manual and then continue the rebase from a git shell.

So I proceeded to do that. One thing I noticed was that git *deleted one of my files!!!* \<-- What on Earth is git thinking? Why would it ever think of deleting a file in response to rebase issues? No one on the team deleted it. There was absolute nothing wrong with the file, and when I undid the deletion, and finished the rebase, the file worked just fine.


Answers:
author: minnsey
body: Hi  

Its difficult to comment without understanding more of the context, is it possible the file was deleted by one commit but restored by another and hence if appeared to have dissappeared because the rebase paused part way through?


Tags: delete

file

git

rebase
Why is SourceTree 2.0+ SO SLOOOOOOW??!?!
Asked by Kenn Gerard Cal:

I've recently updated to SourceTree 2.0.20.1 on Windows, and it doesn't seem like it can push or pull anything from origin. I've reverted to using Git via terminal instead.

When I open it, it downloads \*something\* before opening (after like 20 seconds). Wtf? Are you mining bitcoins in the background???


Answers:
author: matthew connop
body: Uninstall all versions of sourcetree.

Remove (or copy to another location) C:/Users/{username}/AppData/Local/Atlassian

Reinstall sourcetree.

Re-add your repos.

Voila source tree no longer hangs when you try and do anything with it.


author: Mike Corsaro
body: Hello! Could you do the following for me:

* Open the slow repo
* Go to "Repository -\> Benchmark Repo Performance"
* Upload the resulting file

Thanks!

comments: author: Kenn Gerard Cal
body: Here's the file you required:  
<https://drive.google.com/open?id=0B2p4hfHzOsSyYS05RDV3X3FCX00>  

This screenshot was taken after trying to push a commit with just 2 spaces as a change:  
<https://drive.google.com/open?id=0B2p4hfHzOsSySFFjTE1IQkRSYU0>  

This one was taken after 3 minutes:  
<https://drive.google.com/open?id=0B2p4hfHzOsSydGdSMlptREFjc2M>  

This one was taken after 10 minutes:  
<https://drive.google.com/open?id=0B2p4hfHzOsSydmRhQVpIdk1mWk0>  

Note that I did not cancel the Git push. Trying it in the terminal, the operation finished after 2 seconds.
SourceTree 2.0.20.1 only starts when run as adminstrator Win 10
Asked by gdherbert:

I was having trouble with SourceTree not starting on Windows 10. I completely uninstalled SourceTree and reinstalled the latest version. However, it will not start unless I right click and run as administrator. Is theer any way around this? It never used to requrie admin priviledges to start.


Answers:
author: jyo
body: Grant,

SourceTree shouldn't be asking for admin rights every time. This might be a local policy issue. Can you try clearing out the following:

C:\\Users\\%USERNAME%\\AppData\\Local\\Atlassian\\SourceTree\\

and reinstalling?

Thanks,

Jesse


Tags: windows
Always not responding in windows 7
Asked by Patrick Huang:

Terrible experience\~\~ Any action can lead to "not responding".


Answers:
author: matthew connop
body: * Uninstall all versions of sourcetree.
* Remove (or copy to another location) C:/Users/{username}/AppData/Local/Atlassian
* Reinstall sourcetree.
* Re-add your repos.
* Voila source tree no longer hangs when you try and do anything with it.
Where saved password is located?
Asked by Yusoof:

![Screenshot (163).png](/t5/image/serverpage/image-id/1592i2155E82234C2826E/image-dimensions/480x358?v=v2 "Screenshot (163).png")

I cant delete or edit on this page. Nothing happened. Clean reinstall does not work too


Answers:
author: Ana Retamal
body: Hi Yusoof! Are the buttons **'Edit'** and **'Delete'** clickable, or you can not even click on them? Are you able to add a new one?

You can try [wiping your SourceTree preferences](https://confluence.atlassian.com/sourcetreekb/how-to-wipe-sourcetree-preferences-412484640.html). If after this you're still not able to edit your password, can you let us know which version of SourceTree and which OS are you using?

Cheers,

Ana

comments: author: Yusoof
body: already wipe using that method, but nothing help. Even revo uninstaller cant get the work done.

Sourcetree 2.0.20.1 - Windows 10


author: minnsey
body: Hi Yusoof.  

Are you able to delete/edit the bitbucket.org and fuzuyx@bitbucket.org entries? Is it just the first entry you cannot edit?  

The first entry looks strange without a host or username, is that actually how it appears or have you hidden values for privacy.  

SourceTree is actually listing entries from the Windows Credentials Manager there. If you are stuck you can open the Windows Credentials Manager and delete entries with the "git:" prefix.


author: bruskus93
body: Thank you very much, I had the exact same issue on my machine.

Deleting the entries with "git:" prefix did the trick.


author: Martin Rump
body: Had the same problem a moment ago. Thank you for the hint with the Windows Credentials Manager


author: Martin Rump
body: Unfortunately, didn't solve the problem. Now I have a completely empty page on the credentials tab in SourceTree without even the option to add a new saved password.


author: minnsey
body: Hi Martin  

The 'saved passwords' list reflect entries that have been created by command line git etc, not by Sourcetree itself.  

For example if you use the command line to access a private git remote and then refresh the Sourcetree tab you will see the entry from the command line there.  

Sourcetree differentiates between 'Accounts' that it has managed and 'Save passwords' that are not directly managed by Sourcetree but are potentially used when Sourcetree triggers git.  

Or Mercurial.


Tags: password