Configure Git

Rok-tools is configured to perform strict host checking and uses the key found in /root/.ssh/id_rsa to establish an SSH connection to github.com. This guide will walk you through this process. Moreover, you will configure Git to use a username and an email globally.

What You’ll Need

Contact Arrikto

If you don’t have a deployment key, please contact the Arrikto Tech Team to create one for you.

Procedure

  1. Create the SSH configuration directory for user root:

    root@rok-tools:/# mkdir /root/.ssh
    
  2. Get key from github.com and generate its fingerprint:

    root@rok-tools:/# ssh-keyscan github.com >> github_key
    
    root@rok-tools:/# ssh-keygen -lf github_key
    
  3. Cross-check the generated fingerprint with the official GitHub fingerprints.

  4. Update known_hosts:

    root@rok-tools:/# cat github_key >> /root/.ssh/known_hosts
    
    root@rok-tools:/# rm github_key
    
  5. Decrypt the Arrikto provided private SSH key:

    1. Open a terminal and run:

      root@rok-tools:/# gpg -d > /root/.ssh/id_rsa
      

      The above command will appear to hang while it is waiting for the encrypted text.

    2. Copy the encrypted text from the email, including the -----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE----- lines.

    3. Paste the encrypted text into the terminal, including the -----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE----- lines.

    4. Enter the passphrase, when gpg prompts you to.

    5. Press ctrl-d to inform gpg that there is no more input.

    6. You should end up with the private SSH key in /root/.ssh/id_rsa.

  6. Set the correct permissions for the file:

    root@rok-tools:/# chmod 400 /root/.ssh/id_rsa
    
  7. Verify that you can connect to github.com with SSH:

    root@rok-tools:/# ssh -T git@github.com
    
  8. Set a username and an email:

    root@rok-tools:/# git config --global user.name "John Doe"
    
    root@rok-tools:/# git config --global user.email johndoe@example.com
    

Summary

You have successfully configured Git in your management environment with your SSH key and identity.

What’s Next

The next step is to configure the AWS CLI in your management environment.