git

Git aliases

we all do like aliases, right ? https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases Some Aliases git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.st status git config --global alias.bra "branch -a" and then, you just type: git co git br git ci git st git bra .gitconfig all this stuff is saved in ~/.gitconfig $ cat ~/gitconfig # This is Git's per-user configuration file. ... [alias] co = checkout br = branch ci = commit st = status bra = branch -a sha256: 25d19b53fad08e68209e0854cd3b814fc6742f2ab0586ff9b501de88075e251b

Git Branches

Branches some basic commands for branches. you can read the official page for more details create branch you wanna develope a feature, fix a bug, test some stuff … you need a branch ! git checkout -b feature1 push upstream if you have a central repo, push the feature upstream (so others can checkout as well) git push --set-upstream origin feature1 show branch you may have multiple branches, list them all.

Git Clear your History

Clear History have you ever checked in some binarys, confidential stuff or something else by mistake ? Git will keep all your history, that’s their design and purpose. how ever, if you need to cleanup once, here is a short tutorial. Kill Git Config cd myrepo cat .git/config -> note down the url rm -rf .git Create New Repo git init git add . git commit -m "Removed history, ..." Push Remote git remote add origin git@host/yourrepo <- URL you noted down above git push -u --force origin master All in One _url=$(git remote -v |awk '/fetch/ { print $2 }') rm -rf .

GIT add Folder to Repo

wanna switch a local folder to a remote git repo ? https://docs.github.com/en/github/using-git/adding-a-remote GitoLite create git repo with gitolite (myproject) add Folder cd myproject git init git remote add origin git@your-git-server:myproject check Status git remote -v git status add all existing Files, commit and push to remote git add . git commit -m "initial commit" git push --set-upstream origin master sha256: 3d044e15882683dcf8a0cd3b79e464e89ae4b1a5a93a142651f589130f040d7a

Gitolite

You wanna host your own Git Repositories ? Have a look at Gitolite. It does all for you :) Install GitoLite pkg_add gitolite Add git user root@gitserver ~# adduser -silent Enter username []: git Enter full name []: git repo user Enter shell bash csh git-shell ksh nologin sh [ksh]: Uid [1001]: Login group git [git]: Login group is ``git''. Invite git into other groups: guest no [no]: Login class authpf bgpd daemon default pbuild staff unbound [default]: Enter password []: Disable password logins for the user?

Git

Some Git Commands Merge two Repos “merge unrelated histories” git pull origin master --allow-unrelated-histories git push git pull Find deleted File git log --diff-filter=D --summary commit abcecadce91af3814662fa6a04d0f12e361f0574 Date: Sun May 31 23:19:59 2020 +0200 update delete mode 100644 master/sed.tcpdump commit 81ae58d70c27d02eb2f65beed4fe0b571073f087 Date: Fri May 29 16:06:14 2020 +0200 update Restore deleted File git checkout 81ae58d70c27d02eb2f65beed4fe0b571073f087 sed.tcpdump Remove Sensitive Data https://help.github.jp/enterprise/2.11/user/articles/removing-sensitive-data-from-a-repository/ git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch .geheimesfile' \ --prune-empty --tag-name-filter cat -- --all git push origin --force --all git push origin --force --tags sha256: fd74de4918390644e46dffe29a434eb74ba892dd138003a20cb234cce418676e

SSH Audit

ssh-audit is a tool for ssh server auditing. Features SSH1 and SSH2 protocol server support; grab banner, recognize device or software and operating system, detect compression; gather key-exchange, host-key, encryption and message authentication code algorithms; output algorithm information (available since, removed/disabled, unsafe/weak/legacy, etc); output algorithm recommendations (append or remove based on recognized software version); output security information (related issues, assigned CVE list, etc); analyze SSH version compatibility based on algorithm information;