System Environment
- Ubuntu 22.10 kinetic
Installing Git
BASH
# Install git using the apt command
sudo apt update && sudo apt full-upgrade -y
sudo apt install git -y
# Verify the installation
git --version
# Example output
git version 2.25.1
Configuring Git Username and Email
BASH
git config --global user.name "Your Username"
git config --global user.email "Your Email Address"
# Verify the configuration
git config --list
# Example output
user.name=Your Username
user.email=Your Email Address
# Ctrl + Z to exit
The configuration is stored in the ~/.gitconfig file.
For more Git configuration, you can use the git config command or manually edit ~/.gitconfig.
Configuring GitHub SSH
Create the necessary directories and files
BASH
# Create the .ssh directory
mkdir ~/.ssh
# Set permissions:
chmod 700 ~/.ssh
# Create the authorized_keys file:
touch ~/.ssh/authorized_keys
# Set permissions
chmod 600 ~/.ssh/authorized_keys
First, generate a new SSH key
BASH
# The following command will create two files: id_rsa and id_rsa.pub
cd ~/.ssh
ssh-keygen -t rsa -c "[email protected]"
Log in to your GitHub account and go to Settings → SSH and GPG keys.
Click New SSH key → Title → Copy the content from the id_rsa.pub file into the Key field and save.
Copy the content from the id_rsa.pub file in the directory to the GitHub SSH Key and save.
BASH
cat id_rsa.pub
Test the GitHub configuration
BASH
ssh -T [email protected]
Successful response message
BASH
Hi "username!" You've successfully authenticated, but GitHub does not provide shell access.