How to Create a Private SSH Key for Git Projects
  • 26 Apr 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

How to Create a Private SSH Key for Git Projects

  • Dark
    Light
  • PDF

Article summary

For Ion Channel to analyze a private Git project, a private SSH key without a passphrase must be provided at the project level on the Project Settings page or at the team level on the Team Administration page. If you do not already have such a key added to your Git repository, the following can be used to generate the key pair.

  1. In a terminal, enter: ssh-keygen -t rsa -b 4096
  2. When prompted, provide the file name and location for the RSA file (default name is id_rsa).
  3. When prompted for a passphrase, press Enter without entering a passphrase. Repeat this when prompted to enter the passphrase again.

Following these steps will result in two files being generated in the folder that you specified. The private key will have the file name provided. You will use this key when creating/editing the project in Ion Channel.

The other file will be your public key. It will have the same file name but have the .pub suffix. The contents of this file will need to be added to your Git repository's SSH key. You can find instructions for adding an SSH private key to GitHub, GitLab, and Bitbucket via the following links.

Examples

After completing the steps above, the generated keys should look similar to the shortened examples below. When providing these keys, the entirety of the files should be used.

Example Private Key:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAgEAwlMc4KfiKgRnwWarsWtEXSa1H2BMnjZmkT+yq/ecm0KtGc9/sUWt
CsCFqVyHiVNnfQFd4tWDwmFAvu/JDLtPiFrByLMSCRyFaZK0u1WpNmvLhj8I2gxPEDL2+e
by5ocomQ8CCLmpYhNAHq1P0kgqJjbN7Ni5IApOMqIGHQeMo0vh2E...
-----END OPENSSH PRIVATE KEY-----

Example Public Key:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ... username@hostname

Was this article helpful?