Generate SSH Public key
As mentioned earlier, many Git servers use the SSH public key for authentication. In order to provide the SSH public key to the Git server, if a system user does not already have the key, a copy must be generated beforehand. This process is similar across all operating systems. First, you need to verify that you already have the key. By default, the user's SSH key is stored in its
~/.ssh directory. By entering the directory and listing the contents, you can quickly confirm that you already have the key:
authorized_keys2 id_dsa known_hosts
We need to find a pair with &NBSP;
id_dsa or &NBSP;
id_rsa Named file, one with &NBSP;
. pub &NBSP;
. pub file is your public key, The other is the private key. If such a file cannot be found (or there is no
. SSH directory), you can run
Ssh-keygen program to create them. In the Linux/mac system,
ssh-keygen with the SSH package, and on Windows, the program is included in the Msysgit in the software package.
Generating public/private RSA key pair.
enter file in which to save the key (/HOME/SCHACON/.SSH/ID_RSA):
created directory '/home/schacon/.ssh '.
enter passphrase (empty for no passphrase):
enter same passphrase again:
your identification has been saved In/home/schacon/.ssh/id_rsa.
your public key has been saved in/home/schacon/.ssh/id_rsa.pub.
the key fingerprint is:
d0:82:24:8e:d7:f1:bb:9b:33:53:96:93:49:da:9b:e3 [email protected]
ssh-keygen You will first confirm where the key is stored (by default
.ssh/id_rsa ), and then it will ask you to enter the key password two times. If you do not want to enter a password when using the key, leave it blank.
Now, users who do this need to send their own public key to any Git server administrator (assuming the server is using the public key-based SSH authentication settings). All they have to do is copy the contents of their
.pub files and send them by email. The public key looks like this:
NrRFi9wrf+M7Q== [email protected]
For a more in-depth tutorial on generating SSH keys in multiple operating systems, see GitHub's SSH key guide https://help.github.com/articles/generating-ssh-keys.
Git on the server-generate SSH public key