
Jan 14, 2022
Available for senior roles & selected contracts — email me
Whether you're a seasoned developer or just starting out, Git is a tool you'll want set up. Here's how to install and configure it on Linux Mint.
First, make sure your system is up to date. Open your terminal (find it in the menu or hit Ctrl+Alt+T) and run:
sudo apt update && sudo apt upgradeThis fetches the latest package info and upgrades your system. It can take a few minutes.
With the system up to date, install Git with:
sudo apt install gitYour system might ask for your password and confirmation. Type it in and hit 'Y' when prompted. Git is now installed.
Git doesn't know who you are yet, so set your name and email:
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 gets attached to your commits, so make sure it's correct.
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).
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_ed25519These commands will start the SSH agent and add your new key to it.
To make copying your SSH key easier, you can install xclip. Run this command:
sudo apt install xclipIf you don't want to install xclip, you can manually copy the SSH key by displaying its contents.
If you installed xclip, copy your public key to the clipboard with:
cat ~/.ssh/id_ed25519.pub | xclip -selection clipboardIf you didn't install xclip, you can display the SSH key and manually copy it:
cat ~/.ssh/id_ed25519.pubThen, 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'.
Just to make sure everything is rolling, let's check which version of Git we've got:
git --versionThis should spit out something like 'git version 2.x.x'. If you see this, congratulations! You've successfully installed Git.
mkdir my_first_repocd my_first_repogit initThat's it. You've installed and configured Git on Linux Mint and set up SSH for GitHub. You're ready to clone, commit, push, and pull.
Git has a bit of a learning curve, but it doesn't take long before branching and merging feel routine.
A case study on deploying a public, no-sign-up AI service and keeping it secure, well-behaved, and running at a fraction of a cent per story.