0

I was having problems setting a sshkey for gitlab. It stopped working and it wouldnt work. Somehow its working now, I didnt modify anything I simply added got a new key and added it. Im trying to understand a few things though. (I already read the READMEs)

1.Does my user name and email in .gitconfig have to be exactly the same what they are in my Gitlab profile?

2.When I did ssh-keygen -t rsa -b 4096 -C "your_email" and I forgot to change your_email and It still worked. So whats the purpose adding my email in this part?

Olivia22
  • 131
  • 7
  • 1
    [topsail's answer](https://stackoverflow.com/a/72647699/1256452) covers part 2. The answer to part 1 is "no": you can push someone else's commits. Some groups (administratively) prohibit this, and some web hosting sites provide tools to allow administrators to do such a prohibition easily, but base Git doesn't and the defaults for most hosting systems don't. – torek Jun 16 '22 at 20:02

1 Answers1

1

Its really just a "descriptive" comment - not really important except as a way to tell one key from another in a simple human readable way.

All options described here: https://linux.die.net/man/1/ssh-keygen

Similar question asked here as well: Should I use my personal email in my ssh public keys?

It's just one of those funny things that adding the -C option with youremail is in the github docs for ssh-keygen but I'm not clear if it really matters or if github makes use of this comment field in any way - perhaps gitlab is in a similar boat.

topsail
  • 2,186
  • 3
  • 17
  • 17
  • 2
    The comment part of an ssh public key is *not transmitted*, it's merely stored locally so that you can look at it when you look at the file locally. That's what makes it a comment. Neither GitHub nor GitLab can use it as they never even see it. – torek Jun 16 '22 at 20:00