Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

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
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...

7,102 views 5 13
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