Last active
December 7, 2022 07:50
-
-
Save linuxoracledev/ce5d413ed88f4c4221f89b1afc91788e to your computer and use it in GitHub Desktop.
Add ssh key to ssh-agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To see if existing SSH keys are present. Lists the files in .ssh directory, if they exist | |
ls -al ~/.ssh | |
#By default, the filenames of the public keys are one of the following: | |
#id_dsa.pub | |
#id_ecdsa.pub | |
#id_ed25519.pub | |
#id_rsa.pub | |
#If you don't have an existing public and private key pair, or don't wish to use any that are available to connect to #GitHub, then generate a new SSH key as bellow | |
ssh-keygen -t rsa -b 4096 -C "your_git_email@example.com" | |
#When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. #Then type a secure passphrase | |
#To add ssh key to ssh-agent start the ssh-agent in the background. | |
eval "$(ssh-agent -s)" | |
cd /home/azad/.ssh | |
azad@cli:~/.ssh$ cat id_rsa.pub | |
[ | |
#Copy the SSH key to your clipboard. to do so, we need xclip, Downloads and installs xclip. | |
sudo apt-get install xclip | |
# Copies the contents of the id_rsa.pub file to your clipboard | |
xclip -sel clip < ~/.ssh/id_rsa.pub | |
] | |
#In the upper-right corner of any page, click your profile photo, then click Settings.In the user settings sidebar, click SSH and GPG keys. | |
#Click New SSH key or Add SSH key. | |
#In the "Title" field, add a descriptive label for the new key.Paste your key into the "Key" field.Click Add SSH key. | |
#To Configure Git run this command: | |
sudo git config --global user.name "TypeYourName" | |
sudo git config --global user.email "TypeYourEmail" | |
#To check Git configuration settings run this command: | |
git config --list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment