This blog post explains how to use SSH to connect local git to remote repositories.
SSH is a protocol that allows secure communication between a local machine and a remote host, while Git is a distributed version control system.
Different methods to connect to a remote repository are HTTPS and SSH, but SSH offers a greater level of security.
Using a password-based authentication, HTTPS may be vulnerable if someone intercepts the network, compares to SSH, which uses a private-public key pair.
SSH is more convenient than HTTPS which eliminates the need to enter passwords by using an SSH-Agent which stores a passphrase securely in memory and automate the authentication process.
To use SSH, the first step is to generate SSH keys. The most commonly used algorithm is Ed25519.
After generating a private-public key pair, you can check whether you have an SSH key or generate a new key if required.
Next, add the public key to the remote repository by copying the key from your local machine and pasting it into the remote repository.
To connect your private SSH key to the website of the remote repository, add it to ssh-agent.
Finally, testing the SSH connection will let you concludes if everything goes smoothly. You're now ready to use SSH to connect local git to remote repositories and make changes in a secure way.