3 ms·
it'd be nice if the page describes how this tool works and changes it makes. Since it's unclear i'm not sure how this is useful. Also you can configure the id
by sigmonsays 3y ago
it'd be nice if the page describes how this tool works and changes it makes.
Since it's unclear i'm not sure how this is useful.
Also you can configure the identity to use in ssh per host using aliases. If you want to switch identities globally, just load the appropriate key in ssh-agent.
here is an ssh config which binds a specific identity to personal.github.com
Host personal.github.com
ControlMaster no
Hostname github.com
IdentityFile ~/secret/keys/personal/github
IdentitiesOnly yes
bonus points if you set IdentitiesOnly=yes globally
- klaustopher 3y agoBeen doing exactly this for years. Don't know why I'd need a CLI to switch back and forth. Once cloned using the alias and you never have to worry about it again.
- fastest963 3y agoThis doesn't work if you're using an agent like 1Password though and it doesn't handle signing commits with the right key either.
- perdjesk 3y agoUsing git-config it is possible to configure per directory/remote URL different signing keys. [includeIf "gitdir:~/work/client1/"] path = ~/work/client1/.gitconfig [includeIf "gitdir:~/work/client2/"] path = ~/work/client2/.gitconfig $ cat ~/work/client1/.gitconfig [user] email = emailforclient1 name = nameforclient1 signingKey = 3AA5C34371567BD2 [core] sshCommand = ssh -i ~/.ssh/id_client1 $ cat ~/work/client2/.gitconfig [user] email = emailforclient2 name = nameforclient2 signingKey = 4BB6D45482678BE3 [core] sshCommand = ssh -i ~/.ssh/id_client2 See: - https://news.ycombinator.com/item?id=36798978 https://news.ycombinator.com/item?id=36798978 - https://git-scm.com/docs/git-config#Documentation/git-config.txt-usersigningKey https://git-scm.com/docs/git-config#Documentation/git-config...
- ryan-c 3y agoYou can do a bit more, even: https://rya.nc/multi-github-accts.html https://rya.nc/multi-github-accts.html Host *.github.com IdentityFile ~/.ssh/%h_id_rsa IdentitiesOnly yes HostKeyAlias github.com ProxyCommand nc github.com 22 The `ProxyCommand` hack makes a global `ControlMaster auto` still work with a `%C` based `ControlPath`, but using `Hostname github.com` should work when using something like `%n_%p_%r`.
- Macha 3y agoWhy not just use %n in the pattern (hostname as passed on the CLI rather than evaluated in the config) and then `Hostname github.com` inside the `Host` block instead of the latter two commands?
- ryan-c 3y agoI think you may have replied while I was editing to suggest that.
- tr3ntg 3y agoWhat's this github subdomain format? Is this a real url you're matching or syntax for something else like your username / org name?
- ryan-c 3y agoIt's a fake subdomain used to select the key.