For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to install Git and set up SSH keys

Git is the standard for version control. If you plan to write code, deploy projects, or contribute to open source, you need it on your VPS. SSH keys let you authenticate to GitHub, GitLab, or Bitbucket without typing a password every time.

Step 1: Install Git

Ubuntu makes this easy:

sudo apt update
sudo apt install git -y

Check the version:

git --version

Step 2: Configure your identity

Git needs to know who you are for the commits you make:

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Use the same name and email you have on GitHub.

Step 3: Generate an SSH key

An SSH key comes in two parts. A private key that stays on your server, and a public key that you give to GitHub. Generate one with:

ssh-keygen -t ed25519 -C "your@email.com"

You will be asked where to save it. Press Enter to accept the default location (~/.ssh/id_ed25519). You can also set a passphrase for extra security, or leave it empty.

Step 4: Add the key to your SSH agent

Step 5: Copy your public key

Display the public key so you can copy it:

It will look something like this:

Select and copy the entire line.

Step 6: Add the key to GitHub

  1. Click New SSH key

  2. Give it a name like ITITAN VPS

  3. Paste your public key in the Key field

  4. Click Add SSH key

Step 7: Test the connection

You should see:

Cloning a repository

Now you can clone any repository you have access to:

Notice the git@github.com: prefix instead of https://. That is the SSH format.

Useful Git commands for quick reference

Command
What it does

git status

Check what files changed

git add filename

Stage a file for commit

git commit -m "message"

Commit staged changes

git push

Send commits to remote

git pull

Get latest changes from remote

git log --oneline

View commit history

git branch

List branches

git checkout -b branch-name

Create and switch to a new branch

Managing multiple SSH keys

If you have multiple GitHub accounts or other services, create a config file:

Add entries like this:

Common issues

"Permission denied (publickey)" means the public key was not added to GitHub, or you are using the wrong key. Check that you copied the right file (id_ed25519.pub, not id_ed25519).

"Please make sure you have the correct access rights" usually means your key is not associated with the repository. Make sure you are added as a collaborator or have access to the repo.

Conclusion

Git and SSH keys take ten minutes to set up and make your life much easier. Every time you skip typing a password, you will be glad you did it.

Last updated