How do you handle multiple Git identities? Any tools, workflows, or best practices you recommend?
Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
1–6 of 6 posts
Re: Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
#2If you have multiple github accounts, you can use separate keys by defining custom hosts in your ssh config, but that doesn't seem relevant in your case.
Re: Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
#3Are you talking about your git name and email? Because you can set that (and other settings) per-repo simply by omitting --global in `git config`. If you have multiple github accounts, you can use separate keys by defining custom hosts in your ssh config, but that doesn't seem relevant in your case.
Re: Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
#4Are you talking about your git name and email? Because you can set that (and other settings) per-repo simply by omitting --global in `git config`. If you have multiple github accounts, you can use separate keys by defining custom hosts in your ssh config, but that doesn't seem relevant in your case.
Yes, I assume different emails/names and ssh keys. Of course, I can do manual configuration, but I think it is a bit "tiresome".
Re: Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
#5Earlier quoted context omitted.
Yes, I assume different emails/names and ssh keys. Of course, I can do manual configuration, but I think it is a bit "tiresome".
Can I ask what you find tiresome, specifically? If it's because you have tons of repos, there's a little-known git feature where you can set the config for all repos in a directory, so that e.g. ~/work/* uses your work name & email, without having to `git config` every new repo you create or clone. https://alysivji.github.io/multiple-gitconfig-files.html
But I was wondering if anyone has solved a similar problem or uses some ready-made tool)
Re: Ask HN: How do you manage multiple Git profiles (GitHub, Gitlab, Bitbucket)?
#6this is required online security 101 btw. otherwise you're sending your full keychain identity (all your pub keys) to every ssh server you try to connect