Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using includeIf in Git config #145

Open
wincent opened this issue Jan 24, 2024 · 0 comments
Open

Consider using includeIf in Git config #145

wincent opened this issue Jan 24, 2024 · 0 comments

Comments

@wincent
Copy link
Owner

wincent commented Jan 24, 2024

I don't think I'll do this, but I at least wanted to mention it as a possibility.

Variables that I currently set differently on my work vs personal machines:

gitGpgSign: identity === 'wincent' && profile !== 'codespaces',
gitHostSpecificInclude: `host/${hostHandle}`,
gitUserEmail: identity === 'wincent' ? '[email protected]' : '',
gitUserName: identity === 'wincent' ? 'Greg Hurrell' : '',
gitHubUsername: identity === 'wincent' ? 'wincent' : '',

Via host-based includes:

  • On Codespaces, I set user.email to [email protected].
  • Likewise, on my work laptop I set user.email to [email protected].
  • On my personal machines I set some sendmail.* settings.

Additionally:

  • When the gitGpgSign variable is set (ie. everywhere except Codespaces) I set commit.gpgSign to true.
  • When gitHubUsername is set (always, for me) I set github.username to wincent.
  • I set user.name and user.email based on the value of the gitUserName and gitUserEmail variables, respectively; these default to Greg Hurrell and [email protected], except as noted above.

The idea, then, is to use includeIf to set up some config for work repos whenever the remote URL includes github.com/github/. This might replace, in whole or in part, the host-specific config includes.

Now, the main reason why I think I'm not going to do this is it doesn't jive well with my GPG signing strategy (which is to keep a work key on my work machine, and a personal key on my personal machines). Because the work machine only has the work key, if I go into a personal repo like my dotfiles and set things up to use my personal email, I won't be able to sign the commits any more. I think I could set it up to turn off signing in that case, but do I want to? I don't think it's worth it. Likewise, I don't like the security trade-off of putting a personal GPG key on a work machine. So, all of this is a long-winded way of saying that I don't think I'm going to do this, but I wanted to document the possibility anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant