Git on the server-generate SSH public key

Source: Internet
Author: User

Http://git-scm.com/book/zh/ch4-3.html

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:

$cd~/.SSH $ lsauthorized_keys2  id_dsa       known_hostsconfig            id_dsa.pub

We need to find a pair with   id_dsa   or   id_rsa   Named file, one with   . pub   . 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.

$  ssh-keygen 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:

$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 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

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: info-contact@alibabacloud.com 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.