Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Push to gerrit with sourcetree

dbellerose
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 30, 2018

Hello,

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
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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 http://gerrit.googlecode.com/svn/documentation/2.0/user-upload.html).

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

Hope that helps!

Ana

dbellerose
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 30, 2018

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,

Michael Zhou
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 22, 2019

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
expect_pin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 9, 2019

It's work! Thanks

Husam Aldalaq
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 25, 2021

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 = git@github.com:org/repo.git    

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
TAGS
AUG Leaders

Atlassian Community Events