mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.77k stars 2.2k forks source link

Remote specific protocol settings (configuration, feature request) #1435

Open mpacer opened 7 years ago

mpacer commented 7 years ago

Would it be possible to have a default protocol specific to different commands?

The use case I have in mind is having ssh access to all of my personal repositories (which I tend to refer to as origin), but only https access to upstream repositories (which I tend to refer to as upstream).

This acts as a safety measure, as I can easily push to origin over ssh, but need to go through additional steps to push to upstream repositories, for example when making a release and tagging that release through GitHub.

↬@Carreau for introducing this method to me.

mislav commented 7 years ago

Will this be addressed if we add a .hubconfig file that you can put in the working copy of an individual repository? Because that is planned.

mpacer commented 7 years ago

Not quite. This would involve being able to specify a ssh vs https connection for different remotes on the same repository, specifically upstream vs. origin. In practice they are both remote they are just associated with my github repo (e.g., https://github.com/mpacer/nbconvert) vs. the upstream (https://github.com/jupyter/nbconvert).

Failure on my part to use language precisely originally.

Local and remote should have been origin and upstream, changing that now.

mislav commented 7 years ago

Ah, I see now.

Where do you envision these configuration options be kept? Would this global configuration encompass all same-named remotes, e.g. special casing for "upstream" remote (if configured) would be applied to every repo on your machine?

Carreau commented 7 years ago

I guess using something like conditional includes, and/or pushInsteadOf, though these two options do now allow to match on the name of the remote but only on the urls/gitdir. I don't know of any config that allow a per-remote-name configuration but I at least tend to name my remote consistently so a global config would indeed be awesome.