Git CheatSheet
Git CheatSheet
GitHub
- Git is the tool that tracks changes to files over time (like version history).
- GitHub is the service that hosts Git repositories online and provides a user-friendly interface for collaboration.
Resources
Git Clone Repo
1
2
3
4
5
6
# with ssl verifying
git clone url
# without ssl verifying
git -c http.sslVerify=false clone $url
GIT_SSL_NO_VERIFY=true git clone $url
Download .git files
Git-Dumper
Usage:-
1
2
3
git-dumper http://google.com/.git/ /path/to/save
git-dumper http://google.com/.git/ .
Git-Hack
Usage:-
1
2
3
githack http://google.com/ path/to/save
githack http://google.com/ .
Analyzing .git leaks
trufflehog Usage:-
1
trufflehog file://$(pwd) #It scan the current Directory for Git leaks....
gitleaks Usage:-
1
2
gitleaks detect --source .
gitleaks detect --no-git --source /path/to/scan
Manually Way’s Usage:-
1
2
3
4
cat .git/logs/HEAD # Grab the Second Raw Hashes
# Find Secrets...
git show <Paste Hash Here>
cheatsheet
Check Deleted files
1
git log --diff-filter=D --summary | grep delete
Restore Deleted files
1
git restore <File_Name>
Check HEAD logs
1
2
3
4
cat /.git/logs/HEAD
# show Senstive Data
git show <hashes>
check status
1
2
3
4
5
# first check the git status
git status
# If the files modifyed or changes are happen , run this
git diff --cached <modified file name>
Check Git logs
1
git log
check difference in file
1
git diff
This post is licensed under CC BY 4.0 by the author.
