How to setup Git on Server with SSH key Configuration

Wired Wisdom
3 min readJan 19, 2024

Setting up Git on a server and securing it with SSH keys can be broken down into a series of straightforward steps. This guide will walk you through the basics: installing Git, generating SSH keys for secure access, and configuring your server to work smoothly with Git. It’s a simple, step-by-step process designed to get you up and running quickly and securely.

Source

Let us start the process step by step

Step 1: Installing Git on the Server

  1. You have to open a Terminal on the server.
  2. Update the Package Lists (for Ubuntu/Debian):
sudo apt-get update

3. Install Git:

sudo apt-get install git

4. Verify Git Installation:

git --version

Step 2: Create SSH Keys

  1. Generate a New SSH Key Pair:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Replace "your_email@example.com" with your email address. This email is just a label to help identify the key.

Press Enter to accept the default file location and file name.

--

--