This is my first time to push a repo without using an http link so I need to generate a new SSH key. Followed the instruction on github:
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
# Press Enter when:
> Enter a file in which to save the key (/Users/you/.ssh/id_rsa):
# which accepts the default file location which is ~/.ssh/ folder
# Type a secure [passphrase](https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/working-with-ssh-key-passphrases)
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
This is essentially a step to let mac know that you've got a key and it's at your disposal.
# start the ssh-agent
$ eval "$(ssh-agent -s)"
> Agent pid <somenumbers>
# create a config file to load keys into the ssh-agent and store passphrases in your keychain automatically
$ echo "Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa" > ~/.ssh/config
# Add the SSH PRIVATE key to the ssh-agent and store the passphrase in the keychain manually
$ ssh-add -K ~/.ssh/id_rsa
To be honest, I'm not quit sure why you have to add the SSH key to ssh-agent when you've already created a config file which automatically does that... Is it because the last step is to add the PRIVATE Key explicitly?
This is quit straight forward. Follow the steps here on GitHub official Help.
Windows and Linux user please refer to the instruction on github..