SSH provides a secure way for your to connect to and authenticate with GitHub's servers. While HTTPS connections use usernames and passwords as credentials, SSH instead uses public and private key pairs. These can be generated on your system using a CLI like ssh-keygen
and then associated with your GitHub account using the public key.
In some cases, you may need to connect to more than one GitHub account from the same system. For example, you may have separate accounts for personal and professional projects, which can be difficult to manage manually. Using ssh-agent
and a SSH configuration file, you can alleviate this pain point by automatically determining which key to use based on your GitHub repository's git
URL.