Gert Jan
02/22/2024, 8:58 PM#!/bin/bash
# Ensure the script is running as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Update package lists to get information on the newest versions of packages and their dependencies
apt-get update -y
# Install git
apt-get install git -y
# Verify the installation and print the installed version
if command -v git >/dev/null 2>&1; then
echo "Git has been successfully installed."
git --version
else
echo "Git installation failed." >&2
exit 1
fi
Gert Jan
02/23/2024, 8:56 AM