Installing and Configuring Git on Linux Mint
Javier Machin

Jan 14, 2022

Installing and Configuring Git on Linux Mint

A beginner-friendly guide to setting up Git and SSH on Linux Mint

engineeringtutorialversion control

Hey there, Linux enjoyers! 👋 Whether you're a seasoned developer or just starting out, Git is one of those tools you'll want in your arsenal. So, let's get cracking and set up Git on your minty fresh system!


Step 1: Update Your System

First things first, let's make sure your system is up to date. Open up your terminal (you can find it in the menu or just hit Ctrl+Alt+T) and type:

sudo apt update && sudo apt upgrade

This command will fetch the latest package info and upgrade your system. It might take a few minutes, so maybe grab a coffee or do a little dance while you wait.


Step 2: Install Git

Now that we're all up to date, let's get Git installed. It's really simple with this command:

sudo apt install git

Your system might ask for your password and confirmation. Just type it in and hit 'Y' when prompted.
Boom! Git is now installed on your system.


Step 3: Configure Git

Alright, now we've got Git, but it doesn't know who we are yet. Let's introduce ourselves:

git config --global user.name 'Your Name'
git config --global user.email 'youremail@example.com'

Replace 'Your Name' and 'youremail@example.com' with your actual name and email. This info will be attached to your commits, so make sure it's correct (unless you want to pretend to be Batman, in which case, no judgment here).


Step 4: Generate an SSH Key

To securely interact with GitHub, let's create an SSH key. Run the following command:

ssh-keygen -t ed25519 -C 'youremail@example.com'

When prompted, hit Enter to accept the default file location. For added security, you can set a passphrase, but it's optional. This will generate a new SSH key pair (a public and a private key).


Step 5: Add Your SSH Key to the SSH Agent

Now that you've got your SSH key, let's make sure your SSH agent is running and add your key to it:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

These commands will start the SSH agent and add your new key to it.


Step 6: Install xclip (Optional)

To make copying your SSH key easier, you can install xclip. Run this command:

sudo apt install xclip

If you don't want to install xclip, you can manually copy the SSH key by displaying its contents.


Step 7: Copy Your SSH Key to GitHub

If you installed xclip, copy your public key to the clipboard with:

cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard

If you didn't install xclip, you can display the SSH key and manually copy it:

cat ~/.ssh/id_ed25519.pub

Then, head over to GitHub, go to 'Settings' > 'SSH and GPG keys' > 'New SSH key', paste your key, give it a name, and hit 'Add SSH key'.


Step 8: Check Your Git Version

Just to make sure everything is rolling, let's check which version of Git we've got:

git --version

This should spit out something like 'git version 2.x.x'. If you see this, congratulations! You've successfully installed Git.


Step 9: Create Your First Repository (Optional)

Feeling adventurous? Let's create your first Git repository.
These commands create a new directory, move into it, and initialize it as a Git repository:

mkdir my_first_repo
cd my_first_repo
git init

And there you have it, folks! You've just installed and configured Git on your Linux Mint system, and set up SSH for secure GitHub interactions. You're now ready to clone, commit, push, and pull with the best of them.


Git has a bit of a learning curve, but don't let that discourage you. Everyone starts somewhere, and before you know it, you'll be branching and merging like a pro.


Happy pushing, and may your commits always be meaningful! 🚀💻

React setState: What Really Happens Under the Hood?

Unraveling the intricate process behind React's state updates and lifecycle methods

May 18, 2019Read more