Live data from Hacker News

How I configure my Git identities

benji.dog

31–40 of 113 posts

Re: How I configure my Git identities

#31
post #20
post #19

This post is a great reference of what’s possible with git config wrt includes/remotes, and I’m sure I’ll be getting back to it. One thing though: what’s the point of using separate keys for work/personal/github/gitlab? I fail to see a practical and security advantage over using one key (per workstation).

Privacy for sure. It's no ones business to know how certain accounts are related.

Ah, right. E.g. using separate GH accounts for personal and work. Forgot about that!

Re: How I configure my Git identities

#33
post #19

This post is a great reference of what’s possible with git config wrt includes/remotes, and I’m sure I’ll be getting back to it. One thing though: what’s the point of using separate keys for work/personal/github/gitlab? I fail to see a practical and security advantage over using one key (per workstation).

GitHub does not allow you to share a key with another GitHub account anymore

Of course! I’ve been using separate GH accounts for work and personal stuff in the past myself. It’s been years since then and I completely forgot.

In fact, I was one of not too many who used separate account for work, and people didn’t understand it, wondering why the hassle.

Re: How I configure my Git identities

#34
post #19

This post is a great reference of what’s possible with git config wrt includes/remotes, and I’m sure I’ll be getting back to it. One thing though: what’s the point of using separate keys for work/personal/github/gitlab? I fail to see a practical and security advantage over using one key (per workstation).

To add to my other replies to replies in this thread…

These days I prefer to use local VMs to compartmentalize different areas of work (personal, consulting, etc) so my git config is plain and simple. Lately I’ve been doing mostly consulting work around open-source so I’ve been using my primary GH account for the most part, but separate VMs allow me to use a different key (account) without advanced git config incantations.

Re: How I configure my Git identities

#35
I hated configuring multiple Hosts/aliases in my ~/.ssh/config for Github/Bitbucket when dealing with different keys for different clients.

I ended up creating a "SSH environment" manager 4 years ago to help with this: https://github.com/theonejb/sshenv

It's worked wonderfully for me since then, and it's something I use almost daily.

Re: How I configure my Git identities

#36
Thank you for this! I have exactly the same problem and was waiting for the solution to present itself, which it now has.

Aside: I use NixOS with home-manager (on linux and mac), which makes this trivial [1]. Added the following lines to my home-manager config:

  programs.git = {
    enable = true;
    ...
    includes = [
      {
        condition = "hasconfig:remote.*.url:git@github.com:/**";
        contents = {
          user.email = "";
        };
      }
    ];
  }

[1]: https://nix-community.github.io/home-manager/options.xhtml#o...

Re: How I configure my Git identities

#38
post #26
post #14

Is there a risk with not using different keys for work and personal? The private bits are all in the same place: if one is compromised, so are the rest.

About signing keys, it would make sense stopping using a signing key (marking it as such and deleting it) once you stop a job. Your signing key for personal projects probably has a different temporality.

> About signing keys, it would make sense stopping using a signing key (marking it as such and deleting it) once you stop a job.

What does this achieve exactly?

Re: How I configure my Git identities

#39
post #37

Why have multiple git identities in the same machine? I use a single different key with each machine and that's it.

I use different accounts for my work GitHub and my personal GitHub, so this approach would be great if I shared a machine for both of them to keep separation.
Post reply on HN