Making SourceTree the default app on GitHub
Asked by Kenneth Snyder:

When I choose "close in Mac" on GitHub it defaults to GitBox as the application to handle that. How can I change that to SourceTree?


Answers:
author: mohamed irshad
body: You can easily do it.

1. Delete all git management software except source tree
2. update to latest source tree
3. Done. when u click on "Open in desktop" on github, it should automatically take you to source tree.


author: fbricker
body: Hi, you can do:

\<a href="[sourcetree://checkoutRef?ref=master\&cloneUrl=ssh://yourserver.com/repo.git\&type=bitbucket](sourcetree://checkoutRef?ref=master&cloneUrl=ssh://git.dokkogroup.com.ar:48234/git/games/theFroggiesGame.git&type=bitbucket)"\>\[clone\]\</a\>


author: stevestreeting
body: This isn't something you can do, an application has to register itself to handle custom URL schemes like this.

It appears Gitbox must have registered itself for the github-mac:// URL form. I'm not sure if that's considered good practice or not to basically take over someone else's URL handler, given that people might reasonably assume that that button is supposed to open the GitHub for Mac client. I could happily make SourceTree handle this URL form too, but I think the user should have control over which application this goes to if they have more than one installed, and I'm not sure how they do that easily. It appears that <http://www.rubicode.com/Software/RCDefaultApp/> is one way to handle it, but it would be nicer if there was a way that didn't require extra software.

comments: author: Kenneth Snyder
body: Thanks Steve. I did end up downloading the Rubicode software and it does what it says on the tin. I agree it seems something that should be handled at the OS level though.

Now that said, now that I've associated SourceTree to he URL handler the application itself doesn't take the parameter (aka, the repository I'm interested in cloning). Admittedly I don't NEED this functionality but I'm aflicted with an extremely enflamed case of laziness and would like to sooth the rash with a single click appaoch. Interestingly, neither did GitHub (although it was quite happy to beg for the right to have the association).

Anyway, is this something reasonable to add to add to the roadmap? Is there a way to "hack it" into working? Is it a dream worth giving up on?


author: stevestreeting
body: Yeah, a little bit of code is needed on the SourceTree end to make this work. Supporting it is actually trivial, I could probably bash the code out in about 15 minutes - my main concern is whether it would annoy people to take this over. It's not something that's particularly easy to turn on/off dynamically inside SourceTree once it's in (it's advertised in the app's Info.plist), it really does have to be done by the user via that RCDefaultApp.

I'd quite like some other views on this - feel free to raise it as a feature request at <https://jira.atlassian.com> and encourage anyone else who might be interested in it to comment / vote. If it seems like it will be welcome rather than annoying, I'm happy to add it.


author: jhgorse
body: Steve,

I would love to see this GitHub capability added to SourceTree. If there is a JIRA issue, I would be glad to vote it up.

In particular, I am interested in the git-flow-avh et al. workflows on GitHub, BitBucket, etc. using SourceTree.

Cheers,  
Joe


author: stevestreeting
body: It's a bit difficult to re-instate the GitHub client's own URL hook if we overwrite it in Windows, that's why I haven't implemented an option to allow github-windows: URLs to be handled by SourceTree yet (it's toggleable on Mac because restoring the settings is easy). That said, I'm not sure if their own client would restore them if it found they were pointing somewhere else. I've logged this here: <https://jira.atlassian.com/browse/SRCTREEWIN-449>


author: jhgorse
body: I am currently on Mac. I have voted for the Windows feature on JIRA because the Win users need all the help they can get. ;)