this post was submitted on 04 Aug 2023
477 points (95.6% liked)

Programmer Humor

31992 readers
321 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Closed-source quality be like

top 9 comments
sorted by: hot top controversial new old
[–] lowleveldata@programming.dev 13 points 1 year ago (3 children)

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.

[–] quantenzitrone@feddit.de 10 points 1 year ago (1 children)

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.

[–] lowleveldata@programming.dev 8 points 1 year ago

I don't know how to switch keys

"just use the same key"

bruh the Stack Overflow energy

[–] Perhyte@lemmy.world 8 points 1 year ago

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):

Host github.com
  IdentityFile ~/.ssh/github_rsa

Host gitlab.com
  IdentityFile ~/.ssh/gitlab_rsa

This will use the github_rsa key for repositories hosted at github.com, and the gitlab_rsa key for repositories hosted at gitlab.com. Adjust as needed for your key names and hosts, obviously.

[–] Wilker@lemmy.blahaj.zone 5 points 1 year ago (1 children)

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.

#~/.gitconfig
[includeIf "hasconfig:remote.*.url:https://gitlab.com/**"]
path = /path/to/gitlab.gitconfig
[includeIf "hasconfig:remote.*.url:https://github.com/**"]
path = /path/to/github.gitconfig

#example gitlab gitconfig from the included path
[user]
name = Your Name
email = 0000000-YourName@users.noreply.gitlab.com
signingkey = 0000999988887777

[commit]
gpgsign = true

if all works well, Git should be able to automatically use the selected key depending on the repo's stated remote server.

[–] SeerLite@lemmy.blahaj.zone 4 points 1 year ago (1 children)
[–] Wilker@lemmy.blahaj.zone 2 points 1 year ago
[–] dreadedsemi@lemmy.world 7 points 1 year ago* (last edited 1 year ago)

Companies spend a lot of time documenting and reviewing and discussing to release one feature in the meantime you release 100. And if it's too much spaghetti, you can rerelease new 100.

[–] WorldieBoi@lemmy.world 5 points 1 year ago* (last edited 1 year ago)

And lazy. Maybe that's why my code is not so good.