News for hackers. Stuff that matters.
Re:Use multiple Git SSH identities on a single computer by reacweb on Thursday July 20, 2023 @10:27AM (#36800965)
In my .ssh/config, I have a section

    Host github_as_pulp
      Hostname github.com
      User git
      IdentityFile ~/.ssh/pulp.../id_rsa
      IdentitiesOnly yes
I just need to replace github.com by github_as_pulp on my clone command to use my second github account. As it remains in .git/config, it matches automatically when I cd between repositories.

In another script, I have GIT_SSH_COMMAND="ssh -i /.../.ssh/id_rsa -F /dev/null" git archive [email protected]:ace/docsite.git master | tar xp docsiteapp

git and ssh are so versatile. I think that a little documentation is better than a new tool.

Re:Use multiple Git SSH identities on a single computer by blueflow on Thursday July 20, 2023 @11:13AM (#36801701)
> I think that a little documentation is better than a new tool.

Too many people don't enjoy reading the manpages.

Re:Use multiple Git SSH identities on a single computer by kstrauser on Thursday July 20, 2023 @11:28AM (#36801967)
Same. I skimmed the article, thinking “but that’s already built in?”

I have multiple SSH keys on my computer filling different roles (work, personal, niche hobby stuff). I set them up like you did, and then never think about it again.

Re:Use multiple Git SSH identities on a single computer by retrocryptid on Thursday July 20, 2023 @02:44PM (#36804871)
Came here to make the same comment. I do mostly the same thing (and created an alias to make it less cumbersome to type.)

But... I guess if you didn't want to type this and were okay with an additional dependency, gitid has the advantage that you just have to remember what identity is current.

Re:Use multiple Git SSH identities on a single computer by mladen5 on Wednesday July 26, 2023 @05:29AM (#36875022)
I currently use the same thing and the issue is that you can't simply clone repo by copying url, you need to edit it each time. Not sure how does your GIT_SSH_COMMAND achieves in this case?