I can't figure out how to make SourceTree push to Gerrit.
I saw this link but I still don't understand how it can be done: https://answers.atlassian.com/questions/29361/configuring-sourcetree-push-for-gerrit
Apparently according to the release notes for 1.3.3 there is a way to do it but I can't figure it out: http://www.sourcetreeapp.com/update/ReleaseNotes.html#version-1.3.3
Is there a step by step guide somewhere as to how to do it?
Right now I run this command on the terminal to push
git push origin HEAD:refs/for/master
Push changes from a local repository to a remote repositoryClick Push in the toolbar. Select the local branch to push and the remote branch to push to. Click OK.
Click the Push button to push your new branch to the repository. Under the Push? column from the dialog box that appears, select your new branch to indicate that you are pushing that branch to origin and click OK. Click the OK button to push changes to your local repository.
I believe the answer provided by atlassian says to change the name of the remote branch when you see the Push dialog.
This appears to have properly pushed the commits into Gerrit for me. The problem I have now is that the 'refs/for/master' value doesn't persist. Now to figure that out. I will update this post once I've figured that out. Hope this helps even tho it's late to the game.
Update: it turns out that you need to add a push entry under remote origin in the .git/config. You should do this via the git config command (tho i did edit the file manually i'm sure that's bad practice). the push line i wrote is:
push = refs/heads/*:refs/for/*
for clarity here is my remote origin entry in .git/config:
[remote "origin"]
url = ssh://gerrit-test.example.com:29418/mystuff.git
fetch = +refs/heads/*:refs/remotes/origin/*
push = refs/heads/*:refs/for/*
In SourceTree you can now push and it will push to gerrit instead of the final repo. ( you can now also just do git push without specifying anything else and it will push to gerrit ). Note that after a push, SourceTree will still show a number on the Push button that says you still have stuff to push. This is because it is still fetching from the master repo and the changes you've pushed into gerrit have not yet been merged into the master repo. Once your changes have been merged into the master repo the number on the Push button will disappear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With