this post was submitted on 04 Aug 2023
480 points (95.8% liked)
Programmer Humor
32453 readers
712 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I don't post my code to Github because I still couldn't figure out how to switch SSH keys for 2 different git servers smoothly.
you dont have to switch
git will automatically select one that works
I have the same password protected ssh key for every git site i am on tho. The sites only know the public key so its fine.
bruh the Stack Overflow energy
If you're using OpenSSH, the
IdentityFile
configuration directive selects the SSH key to use.Add something like this to your SSH config file (
~/.ssh/config
):This will use the
github_rsa
key for repositories hosted atgithub.com
, and thegitlab_rsa
key for repositories hosted atgitlab.com
. Adjust as needed for your key names and hosts, obviously.have at it!
taken from Gitlab's manual page for creating a key, but i wonder what else could be done to expand on it.
if all works well, Git should be able to automatically use the selected key depending on the repo's stated remote server.
That's GPG, not SSH.
my bad x.x