Remix.run Logo
er453r 5 hours ago

One even-better approach IMHO

Just keep a .gitconfig in your HOME with aliases for your identities. Then just after initializing/cloning the repo do git config-company or git config-personal

    er453r@r7:~$ cat ~/.gitconfig 
    [user]
        useConfigOnly = true
    [alias]
        config-personal = !echo CONFIG-PERSONAL && \
            git config --local user.email 'personal@email.com' && \
            git config --local user.name 'personal' && \
            git config --local core.sshCommand 'ssh -i ~/.ssh/id_rsa_personal'
        config-company = !echo OLD CONFIG-COMPANY && \
            git config --local user.email 'official@comapny.io' && \
            git config --local user.name 'Name Surname' && \
            git config --local core.sshCommand 'ssh -i ~/.ssh/id_rsa_company'
flumpcakes 3 hours ago | parent [-]

How would you do the initial clone without the correct ssh config to begin with? I think the benefit of the article's method is that any clone from their org will just work.

er453r an hour ago | parent | next [-]

You are right - that first clone has to be manually preceded by GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_personal but after this you just configure the repo and forget about it.

I just like this workflow better since it is totally directory/remote agnostic (compared to the article).

Just use whatever suits you best :)

kreetx 2 hours ago | parent | prev [-]

I have something like the parent suggests and yes, the article's idea is better because you don't need to do anything manual nor remember to run your own command at all.