Git: Generate SSH Public key

Source: Internet
Author: User

Generate SSH Public key

Most Git servers will choose to use the SSH public key for authorization. Each user in the system must provide a public key for authorization, and none will generate one. The process of generating the public key is similar on all operating systems. First make sure you have a public key. The SSH public key is stored by default in the directory under the account's home directory ~/.ssh . Go inside and see:

$ cd ~/.ssh$ lsauthorized_keys2 ID_DSA known_hostsconfig

The key is to see if there is something a pair of files to use and to name, this something is usually id_dsa or id_rsa . .pubthe file with the suffix is the public key, and the other file is the key. If you don't have these files, or simply .ssh don't have a directory, you can ssh-keygen create them. The program is provided by the SSH package on the LINUX/MAC system and is included in the Msysgit package on Windows:

$ ssh-keygengenerating public/private RSA key pair. Enter file in which to save the key (/USERS/SCHACON/.SSH/ID_RSA): Enter passphrase (empty for no passphrase): Enter same pas Sphrase again:your identification has been saved In/users/schacon/.ssh/id_rsa. Your public key have been saved in/users/schacon/.ssh/ key fingerprint is:43:c5:5b:5f:b1:f1:50:43:ad:20:a6 : 92:6a:1f:9a:3a [email protected]

It asks you to confirm the location of the public key ( .ssh/id_rsa ), then it will let you repeat a password two times, if you do not want to use the public key to enter the password, you can leave blank.

Now, all users who have done this will have to give their public key to either you or the Git server's administrator (assuming the SSH service is set to use the public key mechanism). They only need to copy .pub the contents of the file and send an email to the administrator. The public key looks roughly like this:

$ cat ~/.ssh/id_rsa.pubssh-rsa aaaab3nzac1yc2eaaaabiwaaaqeakloupkdhrfhy17sbrmtipnltgk9tjom/bwdsugpl+ nafzlhdtyw7hdi4yz5ew18jh4jw9jbhufrviqzm7xlelevf4h9lfx5qvkbpppswg0cda3pbv7kodj/mtyblwxfcr+ hao3fxritbqxix1nkhxphazsmcilq8v6rjsnaqwdsdmfvslvk/7xat3faojoasncm1q9x5+3v0ww68/ eifmb1zuufljqjkprrx88xypndvjynby6vw/pb0rwert/enmz+aw4ozpntpi89zpmvmluayrd2ce86z/il8b+gw3r3+ 1nkatmikjn2so1d01qratlmqvssbxnrrfi9wrf+m7q== [email protected]

For a tutorial on setting up the same SSH public key on multiple operating systems, you can review the SSH Public Key Wizard on GitHub: .

Git: Generate SSH Public key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.