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.
Remote name: ???
Host Root URL:
What do I enter for all of this? The URL to the Bitbucket server is: 192.168.1.129:7990
The full URL to the repo is: 192.168.1.129:7990/scm/tp1/repo1.git
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?
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:
http://192.168.1.129:7990/scm/tp1/repo1 (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.
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 (http://192.168.1.129:7990) and your username.
Yes, on Sourcetree Windows the host type is Stash for Bitbucket Server, which is the old name before Atlassian renamed it to Bitbucket Server.
This is what I entered:
Where "rk-dev2" is the user name on the PC trying to create the pull request from SourceTree.
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: http://192.168.1.129:7990
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: Branch refs/heads/master can only be modified through pull requests.
remote: Check your branch permissions configuration with the project administrator.
Pushing to http://192.168.1.129:7990/scm/tp1/repo1.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://192.168.1.129:7990/scm/tp1/repo1.git'
Completed with errors, see above.
I feel like I am close but something is amiss. I appreciate the help!
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.
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.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
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