jdx/gh

Add protocol option for https clone

huygn opened this issue · 6 comments

huygn commented

By default gh clone via ssh, for my scenario where ssh is blocked by corporate firewall, an option for https clone would be a life saver.

Something like:

gh --protocol=https [user] [repo]
jdx commented

Would probably be better to set by an environment variable so you don't have to type it in all the time. I'd accept a PR for this.

Maybe using env variables to set defaults which can be overwritten by command arguments.
command line options wouldn't be that difficult, but we would need to create one common function for all shells otherwise we'd have massive code duplication.

jdx commented

👎 for flags. Adding a flag parser would really complicate the scripts

Yeah the flag parser code would probably be longer than the actual functionality part. However, I don't think that it would complicate it that much. But if you're not for it, then environment variables are the way to go ;)

jdx commented

I suppose I also don't see why you would want https sometimes and ssh other times. ssh is often better, but there are situations where networking doesn't allow it. In those cases you would always want https.

jdx commented

I've sort of come around here after discovering I can do this in my gitconfig:

[url "ssh://git@github.com/"]
  insteadOf = https://github.com/
[url "ssh://git@github.com/"]
  insteadOf = git://github.com/

Probably not worth doing this to break people's workflows, but you can definitely do the opposite in your gitconfig if you never need ssh support.