news.volyx.in

How I configure my Git identities (benji.dog)

439 points by 8organicbits · 619 days ago · 106 comments on HN

Article summary

The article discusses how to configure Git identities using includeIf and hasconfig:remote.*.url. The author shares their approach to managing multiple Git identities for personal and work projects, including using separate SSH keys and configuring the SSH config file. The author also mentions using the insteadOf directive to simplify Git commands. This approach allows for flexible and conditional configuration of Git identities based on the repository's remote URL.

Main themes

  • Git configuration
  • SSH keys management
  • Multiple identities
  • Repository management
  • Security and privacy

What commenters say

  • Using a single machine for both work and personal projects poses a security risk, and separating them is a better approach.
  • Having separate keys for work and personal projects is necessary for security and compliance reasons, especially when working with GitHub Enterprise.
  • Some argue that using separate keys for different identities is unnecessary and that a single key per workstation is sufficient.
  • The use of includeIf and hasconfig:remote.*.url can be complex and may break scripts that expect a certain remote URL format.
  • Alternative tools and approaches, such as git-switch-user and github-keygen, can simplify the process of switching between Git identities.
  • Using separate VMs or environments can help compartmentalize different areas of work and simplify Git configuration.
  • The order of includeIf directives matters, and the last matching config is used, which can lead to unexpected behavior if not properly configured.
  • Some commenters appreciate the article's approach, while others find it overly complex and prefer simpler solutions.