Public Private Key Encrypytion
It turns out with cryptography that one can have this pattern:
Generate a private-public key pair
The public key can be given out freely
Other software can then generate a challenge, that only the software that holds the private key can answer.
So when you deal with software like GIT that uses ssh as a secure mechanism to authenticate