You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature or problem you’d like to solve
Some users prefer that remotes be interacted with over SSH exclusively but we currently default to https in a few places.
Proposed solution
Supporting a preferSSH setting in gh's config. This requires actually thinking through some UX; we can either expect people to hand-edit the config, offer a hyper specific command just for this setting, or add a gh config key value style command.
How will it benefit CLI and its users?
People like me who prefer SSH over HTTPS will be happy.
Additional context
i'm fine with this being hand-edit for now but i feel like we're only going to find more cases where we want a gh config style command.
Reacted by Jan Tojnar, Andréy Lesnikóv, Nicolò Ribaudo, Peter Piotr Kilczuk, Waldir Pimenta, Owen Voke, Klas Mellbourn, J-P Nurmi, Gabriel de Marmiesse, Carl Walsh and 41 more
I would also personally enable any preferSSH option if it were available. But assuming my git configuration above still works when cloning via gh, it wouldn't seem necessary? (I don't know how gh interacts with git under the hood as to whether this config option would be respected implicitly or not.)
Reacted by Anton Golub
Reacted by Jan Tojnar, Nicolò Ribaudo, Tim Jacomb, Mislav Marohnić, Klas Mellbourn, Johan Lindskogen, Dave Powers, Andrei L, balazs4, Oleksii Filonenko and 21 more
@lindskogen apparently this is a known issue with libgit2 (and therefore cargo). cargo has a workaround: rust-lang/cargo#2078 (workaround is top of issue description)
However, there's another workaround, which I use to avoid a similar problem with homebrew clones.
# in ~/.config/git/config# important that this goes before the [url "[email protected]:"] line causing these problems
[includeIf "gitdir:Homebrew/"]
path=config.homebrew# in ~/.config/git/config.homebrew
[url "https://github.com/"]
insteadOf=[email protected]:insteadOf=https://github.com/
If you're not familiar with conditional includes, the way this works is that, for git repos whose repo path matches Homebrew, it includes an additional gitconfig file. The additional gitconfig file in this case does the oppositeurl.insteadOf transformation. (It translates ssh urls to https instead of vice versa.) A similar approach would work, assuming you can identify a portion of your cargo-index clone's path to use for the conditional include.
Activity
jasonkarns commentedon Feb 25, 2020
FWIW, I use the following git configuration to remap all http(s) URLs to SSH:
I would also personally enable any
preferSSHoption if it were available. But assuming my git configuration above still works when cloning viagh, it wouldn't seem necessary? (I don't know howghinteracts with git under the hood as to whether this config option would be respected implicitly or not.)timja commentedon Mar 4, 2020
Jasons workaround worked for clone and fork for me
vilmibm commentedon Mar 4, 2020
TIL
insteadOf, thanks @jasonkarns . I think we'd respect that in all cases...lindskogen commentedon Mar 17, 2020
I tried using
insteadOfbut then I couldn't use cargo, the rust build tool, anymore since it's index is on GitHub and cargo uses https references.jasonkarns commentedon Mar 18, 2020
@lindskogen apparently this is a known issue with libgit2 (and therefore cargo). cargo has a workaround: rust-lang/cargo#2078 (workaround is top of issue description)
libgit2 pr: libgit2/libgit2#4667
However, there's another workaround, which I use to avoid a similar problem with homebrew clones.
If you're not familiar with conditional includes, the way this works is that, for git repos whose repo path matches
Homebrew, it includes an additional gitconfig file. The additional gitconfig file in this case does the oppositeurl.insteadOftransformation. (It translates ssh urls to https instead of vice versa.) A similar approach would work, assuming you can identify a portion of your cargo-index clone's path to use for the conditional include.