Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Push to gerrit with sourcetree


I want to push commit to gerrit with sourcetree.

I read a previous answer edited in 2014 about this topic, but it seems that nobody found solution to solve the problem. 

I have the last version of sourcetree, is it possible to do this now?

Best regards,



1 answer

0 votes
Ana Retamal Atlassian Team Mar 30, 2018

Hi David! You can use SourceTree to push and pull with any valid git remote. However Gerrit tends to use an extended push syntax / settings to be specific about what changes are for review - if you need to specify those on demand you would be better to push from the command line, but if you can define them as a static rule in your .git/config then SourceTree will respect that (see the section about editing .git/config here

I also found some threads with more info about this, you can read them  here and here.

Hope that helps!


Hello Ana,

Unfortunately, i already test those thread but they are not working.

From command line the push to gerrit is working.

When i put the value :

push = refs/heads/*:refs/for/* in the section remote origin in the git config file, the

push action create a branch and don't make  a push to gerrit.

I don't understand why.

Best regards,

Under the "remote branch" column on push dialog, type "refs/for/<your_feature_branch>" or "refs/for/master" depending upon which branch you want to push to.

Like expect_pin likes this

It's work! Thanks

This is not related to Gerrit but I'm running into an issue with Sourcetree and custom fetch/push Refspec set in .git/config. I've been digging for a while and this is the closest comment I've seen to my issue.

If I set my QA team with their environment to only track QA subdirectory branches i.e

[remote "origin"]    url =    

fetch = +refs/heads/qa/*:refs/remotes/origin/qa/*    

push = refs/heads/*:refs/heads/qa/*


fetch is respected and Sourcetree would only show the qa/ subdirectory.

checkout of a remote branch (doesn't exist locally) Sourcetree would default to using qa/branch-name instead of branch-name (given the remote branch name as origin/qa/branch-name)

push works ONLY if the branch already existed in remote, so pushing changes to the branch. However, with a new branch (not published to remote) if I click on Push, the local branch would not be listed in the list of branches that could be pushed.


Generally with the terminal or most other GUIs I've used, when the refspec is set in .git/config, all interaction would default to those Refspecs, with Sourcetree that doesn't seem to be the case. I'm wondering if there's something I'm missing.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events