git
Git usually comes pre-installed with most Linux distros, but you if not in yours, you can install it via you package manager (apt
, dnf
etc) as instructed on Git download page:
# For Fedora:
sudo dnf install git
Referring the First-Time Git Setup page:
To set name and email across all your repos, set it in global Git config as:
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"
To verify, you can view your global git config as: git config list --global
. Your global git config is stored in ~/.gitconfig
file
You can also refer my git config
Generate new key pair (passing parameters: type -t
and comment -C
):
# You will be prompted for the key's storage location and passphrase
ssh-keygen -t ed25519 -C "john.doe@example.com"
Your keys would be saved in the ~/.ssh/
folder and the pair would be named like:
keyname
for private keykeyname.pub
for the public keyYou can notice it in the output or previous command as:
Your identification has been saved in /home/kumar/.ssh/id_ed25519
Your public key has been saved in /home/kumar/.ssh/id_ed25519.pub
Start ssh-agent
in the background:
eval "$(ssh-agent -s)"
Add your SSH private key to the ssh-agent
:
ssh-add ~/.ssh/id_ed25519
View your SSH public key and copy the output contents
cat ~/.ssh/id_ed25519.pub
Log into your GitHub account. Go to Settings
> SSH and GPG keys
. Click New SSH key
. Give it a title and paste the previous noted output into the Key
textarea box. Finally click Add SSH key
Test if the SSH connection method works:
ssh -vT git@github.com
In the output:
...
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
...
Hi datkumar! You've successfully authenticated, but GitHub does not provide shell access.
Also try cloning any GitHub repo via the SSH method url: git@github.com:USERNAME/REPONAME.git
References: