Live data from Hacker News

How I configure my Git identities

benji.dog

111–113 of 113 posts

Re: How I configure my Git identities

#111
post #108

I do something similar, but instead of `insteadOf`, I just clone the repo with `gh-work:org/repo`, and in the git config: [includeIf "hasconfig:remote.*.url:gh-work:**/**"] path = ~/.gitconfig.d/gh-work.inc So, any git repo cloned with the ssh identity defined under `gh-work` will take on the config of `gh-work.inc`, which includes the git identity, and also the same signing key as in the ssh config. Essentially, the…

In my experience scripts that expect your remote to be a certain way will break with this approach.

I don't really use a lot of script that wraps git; but so far the two things I do use---lazygit and github cli---don't have problems with this approach. Github CLI can identify the correct corresponding repo on Github, and also can choose the right user account associated with this repo if there are more than one authenticated user.

I mean, it seems to me that any script that tries to do something with git remote URL, should deal with any string that git thinks is a valid remote URL. `ssh-host-name:owner/repo` is not exactly an edge case.

Re: How I configure my Git identities

#112
post #107

Earlier quoted context omitted.

Wait, ssh has a config file?! And I should learn about it!? lol, you’re an ass

I’ve spent too much of my career picking up after people like you.

You haven’t. That’s cool though, I can understand your frustration.

Re: How I configure my Git identities

#113
post #76

This is a nice trick. But if you: * use a dedicated work machine and * also want to version control your dotfiles (including ~/.config/git/) and * don't want to leak your work repository organisation via your dotfiles, you can instead add something like [include] path = work.gitconfig which will override any settings above it and also fail gracefully/silently if work.gitconfig does not exist.

What would work.gitconfig include in this case?

A work-specific email address and PGP key.
Post reply on HN