Git Terminal Generate Ssh Key

Sep 26, 2019 You generate an SSH key through macOS by using the Terminal application. Once you upload a valid public SSH key, the Triton Compute Service uses SmartLogin to copy the public key to any new SmartMachine you provision. SSH keys are created using a key generation tool. The SSH command line tool suite includes a keygen tool. Most git hosting providers offer guides on how to create an SSH Key. Generate an SSH Key on Mac and Linux. Both OsX and Linux operating systems have comprehensive modern terminal applications that ship with the SSH suite installed.

Hi there! This post will be pretty straightforward and will cover Windows, Mac, and Linux, so if you don’t know how to do it already, read on.

Windows

  1. Creating an SSH key on Linux & macOS 1. Check for existing SSH keys. You should check for existing SSH keys on your local computer. You can use an existing SSH key with Bitbucket Server if you want, in which case you can go straight to either SSH user keys for personal use or SSH access keys for system use. Open a terminal and run the following.
  2. How SSH key authentication works. SSH public key authentication works with an asymmetric pair of generated encryption keys. The public key is shared with Azure DevOps and used to verify the initial ssh connection. The private key is kept safe and secure on your system. Set up SSH key authentication.

Just follow these 5 steps:

  1. Go to this address, and download Git for Windows, after the download install it with default settings
  2. Open Git Bash that you just installed (Start->All Programs->Git->Git Bash)
  3. Type in the following: ssh-keygen -t rsa (when prompted, enter password, key name can stay the same)
  4. Open file your_home_directory/.ssh/id_rsa.pub with your favorite text editor, and copy contents to your Git repository’s keys field (GitHub, beanstalk, or any other repository provider), under your account.
  5. Be sure that you don’t copy any whitespace while copying public key’s content (id_rsa.pub)

Note: your_home_directory is either C:Usersyour_username (on Windows Vista / 7 / 8 / 10), or C:Documents and Settingsyour_username (on Windows XP)

Mac

Follow these 5 steps:

  1. Start the terminal
  2. Navigate to your home directory by typing: cd ~/
  3. Execute the following command: ssh-keygen -t rsa (when prompted, enter password, key name can stay the same)
  4. Open the file you’ve just created ~/.ssh/id_rsa.pub with your favorite text editor, and copy contents to your Git repository’s keys field (GitHub, beanstalk, or any other repository provider), under your account.
  5. Be sure that you don’t copy any whitespace while copying public key’s content (id_rsa.pub)

Linux (Ubuntu)

Follow these 5 steps: Windows server 2008 r2 key generator.

  1. Open console
  2. cd ~
  3. ssh-keygen -t rsa (when prompted, enter password, key name can stay the same)
  4. open file /home/your_username/.ssh/id_rsa.pub with your favorite text editor, and copy contents to your Git repository’s keys field (GitHub, beanstalk, or any other repository provider), under your account.
  5. Be sure that you don’t copy any whitespace while copying public key’s content (id_rsa.pub)

Additional info

When you create private/public SSH keys on your machine (that’s what you did in the above steps), it’s not enough. You need to give your public key to the repository in order to pair the Git server with your local machine (that’d be steps 4. and 5. above).

Most of the popular repositories will give you web interface access to the application, and here’s how it looks like on Github:
After this step, you’re ready to start using Git.

Conclusion

I hope this wasn’t too complicated to follow, and also I hope it was helpful to someone!

Cheers!

____________________________________________________________________________________________

Note! This article was revised on Jul 26, 2019. The original article was posted in 2011 by Mladen Lotar.

This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-01-22. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise.For help with the upgrade, contact GitHub Enterprise support.

After you've checked for existing SSH keys, you can generate a new SSH key to use for authentication, then add it to the ssh-agent.

In this article

If you don't already have an SSH key, you must generate a new SSH key. If you're unsure whether you already have an SSH key, check for existing keys.

If you don't want to reenter your passphrase every time you use your SSH key, you can add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.

Generating a new SSH key

  1. Open TerminalTerminalGit Bash.

  2. Paste the text below, substituting in your GitHub Enterprise email address.

    This creates a new ssh key, using the provided email as a label.

  3. When you're prompted to 'Enter a file in which to save the key,' press Enter. This accepts the default file location.

  4. At the prompt, type a secure passphrase. For more information, see 'Working with SSH key passphrases'.

Adding your SSH key to the ssh-agent

Git Bash Add Ssh Key Windows

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key. When adding your SSH key to the agent, use the default macOS ssh-add command, and not an application installed by macports, homebrew, or some other external source.

  1. Start the ssh-agent in the background.

  2. If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config/generated-ssh-key-which-one-do-i-keep-on-local.html. file to automatically load keys into the ssh-agent and store passphrases in your keychain.

  3. Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

    Note: The -K option is Apple's standard version of ssh-add, which stores the passphrase in your keychain for you when you add an ssh key to the ssh-agent.

    If you don't have Apple's standard version installed, you may receive an error. For more information on resolving this error, see 'Error: ssh-add: illegal option -- K.'

  4. Add the SSH key to your GitHub account.

If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys. It also comes with the Git Bash tool, which is the preferred way of running git commands on Windows.

  1. Ensure the ssh-agent is running:

    • If you are using the Git Shell that's installed with GitHub Desktop, the ssh-agent should be running.
    • If you are using another terminal prompt, such as Git for Windows, you can use the 'Auto-launching the ssh-agent' instructions in 'Working with SSH key passphrases', or start it manually:

  2. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

  3. Add the SSH key to your GitHub account.

  1. Start the ssh-agent in the background.

  2. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

  3. Add the SSH key to your GitHub account.

Further reading

Git Terminal Generate Ssh Key Password

  • 'About SSH'
  • 'Working with SSH key passphrases'