Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to configure Sourcetree to perform a pull request with Bitbucket Server

I have installed an evaluation version of Bitucket Server on a PC on my local network. I have then installed SourceTree on a different PC.  After committing an update on a branch I want to perform a pull request. If I do this within SourceTree it tells me I must configure a remote before it will allow it.

Specifically, it wants the following information.

Required Information:

   Remote name:  ???

   URL/Path: ???

Host Type:

Host Root URL:


What do I enter for all of this? The URL to the Bitbucket server is:

The full URL to the repo is:

I have tried variations of this already and have not had success. Note that if I open a browser and go directly to the BitBucket and create a pull request there, that seems to work fine. Is it possible to do this from within SourceTree?

1 answer

1 accepted

0 votes
Answer accepted
Mikael Sandberg Community Leader Sep 27, 2018

Hi Randy,

Welcome to the Atlassian Community.

The repository you did your commit in, does it exist on your Bitbucket Server? If not then the first step would be to create it on Bitbucket and then follow the instructions on how to import existing code (your repository on your other machine). Once that is done you set up the extended support in order to initiate pull requests from within Sourcetree by clicking on Settings, select the remote repository path, select edit and from here you can enter the host type, host root URL and username.

Yes, the repository does indeed exist. I can do pushes and pulls with no problem (with all branch permissions removed). 

My question is what exactly do you put in those fields that I have listed in BOLD in my original post? Is "Remote Name" arbitrary or does it correspond to something configured in the BitBucket server setup? What specifically would you enter into URL/Path? As mentioned, the link to the server is:

The full path to the repository is:   (where tp1 is the name of the project and repo1 the name of the repository)

Curiously, for "host type" the WIN10 version of SourceTree does not provide an option for "BitBucket Server" while the MAC version does. 

Mikael Sandberg Community Leader Sep 27, 2018

In Sourcetree, in the tab for your repository click on Settings in the upper right-hand corner. From here select the remote repository path (origin by default) and then select Edit. From here you can enter the Host Root URL ( and your username.Sourcetree.png

Yes, on Sourcetree Windows the host type is Stash for Bitbucket Server, which is the old name before Atlassian renamed it to Bitbucket Server. 

Mikael Sandberg Community Leader Sep 27, 2018

For your reference, here is the Bug logged about the host type still being Stash, SRCTREEWIN-7725

This is what I entered:

Where "rk-dev2" is the user name on the PC trying to create the pull request from SourceTree.Capture.PNG

Let me know if you see anything you think is incorrect.

If I then attempt to Create Pull Request, I get a dialog with these three settings:

Submit via remote: origin:

Local branch: master

Remote branch: master

These appear to look correct to me. Again let me know if you would change anything.

Then when I hit the "Create Pull Request On Web" button I get the red FAIL bar with a message that states:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-upstream origin master:master
POST git-receive-pack (201 bytes)

remote: ----------------------------------------------------
remote: Branch refs/heads/master can only be modified through pull requests.
remote: Check your branch permissions configuration with the project administrator.
remote: ----------------------------------------------------

Pushing to
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

Completed with errors, see above.

I feel like I am close but something is amiss. I appreciate the help!

Mikael Sandberg Community Leader Sep 27, 2018

Did you do your commit on master? The error indicate that you did and on Bitbucket it is setup to not allow any commits without a pull request. If that is the case, the easiest way to solve it is to locally create a new branch on your commit, push that new branch up and then create a pull request from the new branch to master.

This may be a clue. 

I noticed that an option under the "Remote branch" is the name of the branch I am attempting to merge to the master on the server. In this case, does "Remote branch" refer to the branch on the local PC or the server? If I change it to the name of the development branch, the server then seems to accept the request including opening up a browser so the process can be completed in a Bitbucket browser page.

Perhaps my confusion is that, in this case, the remote branch refers to the non-server machine. IE: The PC trying to perform the pull request via SourceTree. 

Mikael Sandberg Community Leader Sep 27, 2018

Remote branch refers to the branch that your local branch is tracking/is a copy of. You can change it to a different branch, so you can push your local changes to a different branch.

I think your last statement gets to the heart of the issue. When using SourceTree to perform a pull request (for an eventual merge to the server master), the name of the branch you are pushing cannot be one's local master. It must be named something else. This looks like it can be done before or after the local commit but I believe it is better practice to create the branch before you start the local development. Once the (alternatively named) branch is pushed to the master, it will be merged after the pull request is approved.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,262 views 4 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you