Git

GIT

Git Cheat Sheet #


🔧 Configuration (One-time setup) #

git config user.name “Your Name”
git config user.email “you@example.com

Set username and email for commits.


📁 Repository Setup #

git init
git init -b main
git remote add origin

Initialise a repository and connect it to a remote.


🔍 Status & Inspection #

git status
git log
git show
git diff

Check repository state, history, commit details, and differences.

GitHub

Adding a SSH key to GitHub account #

ls -al ~/.ssh

Generate a key

ssh-keygen -t rsa -b 4096 -C <user mail id>
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa

Clip or copy manually

clip < ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa.pub

Go to GitHub, add the public key to settings -

https://github.com/settings/keys

Home | Technology