Azure DevOps Server 2019 Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

In this section we'll go through the commands for generating SSH keys:

  1. The following commands will let you create new default SSH keys. Running this command will overwrite any existing default keys. Launch bash and use the ssh-keygen command as follows. This produces the two keys that are needed for SSH authentication: your private key ( id_rsa) and the public key (id_rsa.pub):
ssh-keygen -C "tarun@contoso.com"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/tarun/.ssh/id_rsa): /home/tarun/.ssh/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tarun/.ssh/id_rsa.
Your public key has been saved in /home/tarun/.ssh/id_rsa.pub.
It is important to never share the contents of your private key. If the private key is compromised, attackers can use it to trick servers into thinking the connection is coming from you.
  1. Add the public SSH key to the user ID in Azure DevOps Server. To do this, navigate to Security first:
  1. Select SSH public keys, click Add, copy the content of id_rsa.pub from the .ssh folder, and save your changes:
  1. You are now ready to clone the Git repository using your all-new SSH keys. Navigate to the code hub in the parts unlimited team project. You'll notice that the clone dialogue has a clone URL for HTTP and SSH. Select SSH and copy the URL:
  1. Run git clone from the command line to clone the Git repository using SSH:
git clone ssh://azdo2019:22/Azure DevOps Server/DefaultCollection/PartsUnlimited/_git/MyMigratedApp