Install

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git
git --version

Configure

Configure Git

git config --global user.name "Xyz"
git config --global user.email "[email protected]"

# Enable main as the default branch
git config --global init.defaultBranch main

# Enable colours
git config --global color.ui auto

# Check the configuration
git config --list

Generate SSH key

# Generate SSH key
ssh-keygen -t ed25519 -C "[email protected]"

# Start ssh-agent in the background
eval "$(ssh-agent -s)"

# Add SSH key to ssh-agent (rename key if needed)
ssh-add ~/.ssh/id_ed25519

Add SSH key in Github/Gitlab

# Print the public SSH key (rename key if needed)
cat ~/.ssh/id_ed25519.pub

# Or
xclip -sel clip < ~/.ssh/id_ed25519.pub

Verify Github/Gitlab connectivity

ssh -T [email protected]

# Or (rename domain)
ssh -T [email protected]

# Or run in verbose mode
ssh -Tvvv [email protected]

Connect to Github/Gitlab Repo

First initialization

cd folder/to/myWebsite
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:xxxxx/xxxxx.git
git push -u origin main

Connect to existing Remote

git clone [email protected]:xxxxx/xxxxx.git

# Restore Submodules (e.g. themes):
git submodule update --init --recursive

# View the remote repository
git remote -v
git remote show origin

Make Commits

git status
git add file
git commit -m "message"
git push -u origin main

If you liked this, consider sending a tip by ko-fi from the button below, and if you want to send me any feedback, you can reach me by email or on Nostr @al3xis npub10xxhztawwgtuapdej49q5jgfawu5p0f2j2tzuaxxww2hl546ct3sr7pcjl. ko-fi