To set up Git on your new Linux PC, follow these steps:
sudo apt update
sudo apt install git
(For other package managers like yum
or dnf
if you're on a different Linux distribution, replace apt
with the appropriate manager.)
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Save the key in the default location (usually ~/.ssh/id_rsa
) and press Enter through each prompt.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
Then paste it into your Git provider's SSH keys settings.
ssh -T [email protected]
(Replace github.com
with your Git provider if needed, like gitlab.com
.)
You’re all set up to use Git on your new Linux PC!