After I setup everything to use SSH key to connect to Gitlab. SSH still keeps asking me to enter my passphrase when I tested it with the following command.
ssh -T email@example.com Enter passphrase for key '~/.ssh/id_rsa':
Well, I didn't setup everything correctly. I missed the step to add my SSH key to the ssh-agent.
With SSH keys, if someone gains access to my computer, they also gain access to every system that uses that key. To add an extra layer of security, you can add a passphrase to your SSH key or you can use ssh-agent to securely save your passphrase so you don't have to reenter it.
# Start ssh-agent in the background. eval $(ssh-agent -s) # Add SSH private key to the ssh-agent ssh-add ~/.ssh/id_rsa
ssh-agent will save your passphrase for this session only. If you log out and log back in, you still need to enter your passphrase again. To completely avoid entering the passphrase, then don't set a passphrase in the first place. To do this, set an empty passphrase with the following command.
# Change your passphrase to empty. ssh-keygen -p -f ~/.ssh/id_rsa