In the previous chapter, we generated an SSH key pair.
Now, use the clip < command to copy the public key to your clipboard:
[user@localhost] $ |
clip < /Users/user/.ssh/id_rsa.pub |
Now we can test our SSH connection to GitHub:
[user@localhost] $ |
ssh -T [email protected] |
If the last line includes your GitHub username, you have successfully authenticated!
Now we can add a new remote to our Git repository using SSH.
First, obtain the SSH address from our repository on GitHub:
Next, use that address to add a new remote origin:
[user@localhost] $ |
git remote add ssh-origin [email protected]:code7school-test/hello-world.git |
Note: You can switch a remote origin from HTTPS to SSH using the command: git remote set-url remote-name [email protected]:username/repository.git. |
[user@localhost] $ |
git remote set-url origin [email protected]:code7school-test/hello-world.git |