Git Tree
log --graph --decorate --pretty=oneline --abbrev-commit
Create alias under ~/.gitconfig
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"
https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
Tag: git
-
Git Aliases
-
Extended GIT Information in bash PS1
Extended GIT Information in bash PS1
This will generate shell similar to this :
Multiline version:
┌──┤ greg: ~/dev/discovery/discovery-agent │ master ≡ !1 +2 -2 ≡ 2 weeks ago └── λ

Format `branch ≡ changes additions deletions ≡ last commit`
Example `master ≡ !1 +2 -2 ≡ 2 weeks ago`Since we are interested in interactive shells only we will edit `/etc/profile` and add the following
# Get branch name parse_git_branch() { # git branch | grep -Po '(?<=\*\s)(.*)' local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/') # When there is no initial commit, git branch will not return any branches, use a fallback method if [ -z "$branch" ]; then branch=$(git status | grep -iPo '(?<=On branch\s)(.*)') fi echo $branch } parse_git_status() { # changes to existing files # 0 = Changed Files, 1 = Additions, 2 = Deletions local gitstat=$(git diff --shortstat 2> /dev/null | grep -Po '\d') if [ -z "$gitstat" ]; then gitstat="0 0 0" fi # replate \n with blanks gitstat=$(echo "$gitstat" | tr '\n' ' ') # untracted(??) or added(A) files local gitfiles=$(git status --untracked-files=all -s 2> /dev/null | grep -E '??|A' | wc -l) echo "$gitstat $gitfiles" } parse_git_hascommit() { val=$(git log 2> /dev/null | grep -iPo 'does not have') echo "result :: $val" if [ -z "$val" ]; then echo 0 return 0 fi echo 1 } git_status_ps1() { green_light="\e[38;5;82m" red="\e[91m" blue="\e[34m" reset="\e[0m" inrepo=$(git rev-parse --is-inside-work-tree 2>/dev/null) if [ -z "$inrepo" ]; then exit fi #hascommit=$(parse_git_hascommit) #echo "has :: $hascommit"i # can't get time unless we have a commit # capture error 'fatal: your current branch 'master' does not have any commits yet' and don't display time gittime=$(git log -1 --format=%cr 2> /dev/null) gitstat=$(parse_git_status) IFS=' ' read -r -a array <<< $gitstat if [ -z "${array[0]}" ]; then array[0]=0 array[1]=0 array[2]=0 fi branch_color=$green_light if [ "${array[0]}" -gt "0" ]; then branch_color=$red fi if [ -z "$gittime" ]; then gittime="never" fi GIT_PS1="$branch_color$(parse_git_branch) $reset ≡ $green_light ~${array[3]} !${array[0]} +${array[1]} $red-${array[2]} $reset ≡ $gittime" echo -e $GIT_PS1 } PS1='┌──┤ \[\033[01;32m\]\u:\[\033[00m\] ' PS1=$PS1'\[\033[01;34m\]\w\e[0m │ $(git_status_ps1)\n└── λ ' -
Fingerprint cannot be generated while adding new ssh key in GitLab
This applies to Windows only machines.
I have GitLab running and was adding a new ‘ssh key’ from windows that was generated using a standard ssk-keygen command but was reciving following error:
“Fingerprint cannot be generated”
Command used to generate key:
ssh-keygen -t rsa -C "gbugaj@localhost" -b 4096
This produces a key in ‘id_rsa.pub’ file, from there I cated that file and copies the content of if by ‘HIGHLIGHTING’ directly in the command window.
This is the result that got when pasted it
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDuer2ZkTKwsirssZTBaJiyr/GpALglr6X9Ct2cysvgYs05SEvz+B66US4bFv5IVwiOEXJ51oR0EF0/oDv4Juq1zzvydX44rdKFwlL7Qq7Uezxw4FCJotn/wZqpuaScNszP8/gvZY82j9HCYmITFWobwk1JGvQnezbZ KsaUtUEQwnptYbWvOZ9yNRRzwkntafOBS2l18wJNl6bjHHUJ6NIzRMudvd7/AjqP5qWL3GjJ9ecyHU0Dox3fIAfzlMRhKCQswPos7i35GWtLBzaOfeqJ2iZA2eGjfh1cGW71hyvO72+rxjjXk3uUvSqFP+WWSrt8VdJJqXfhk0RFqDxcUku6fRWeALp0qWna6Qm8/CbF rw0t0s0bF557GqaJCIyMEqj+OVMpcMYCTStnjuTNM8OIz/A3BCJbwt9GsojyFUYesfA0i/4tt9MPYAfcPxO914IYn3mq7Qcvq7RgTJPgM8SGY+SIpACjFKaF6wOf91oa105PcPY4yvISLa40GivN0K871yjo/2Jwq6w6ZE601LD0FngWhrfKejueKucvNvYtdR/aX7LL Oq6md0HK6ybIGKJH2qph3+GJP/AUAf85bhWe1mPw3woZ28bWjo+Kp5zeTJqtd6QTDWTkDftsQJcmMgT43lViJBqChTTA/oGiXiV62PMKMeMCDaTYNkuZZvLE8Q== gbugaj@localhost
As you see here lines are split, this is the problem. To solve this we just need to open the file in some editor and copy it from there so all the text is on one line.
ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAACAQDuer2ZkTKwsirssZTBaJiyr/GpALglr6X9Ct2cysvgYs05SEvz+B66US4bFv5IVwiOEXJ51oR0EF0/oDv4Juq1zzvydX44rdKFwlL7Qq7Uezxw4FCJotn/wZqpuaScNszP8/gvZY82j9HCYmITFWobwk1JGvQnezbZ KsaUtUEQwnptYbWvOZ9yNRRzwkntafOBS2l18wJNl6bjHHUJ6NIzRMudvd7/AjqP5qWL3GjJ9ecyHU0Dox3fIAfzlMRhKCQswPos7i35GWtLBzaOfeqJ2iZA2eGjfh1cGW71hyvO72+rxjjXk3uUvSqFP+WWSrt8VdJJqXfhk0RFqDxcUku6fRWeALp0qWna6Qm8/CbFrw0t0s0bF557GqaJCIyMEqj+OVMpcMYCTStnjuTNM8OIz/A3BCJbwt9GsojyFUYesfA0i/4tt9MPYAfcPxO914IYn3mq7Qcvq7RgTJPgM8SGY+SIpACjFKaF6wOf91oa105PcPY4yvISLa40GivN0K871yjo/2Jwq6w6ZE601LD0FngWhrfKejueKucvNvYtdR/aX7LLOq6md0HK6ybIGKJH2qph3+GJP/AUAf85bhWe1mPw3woZ28bWjo+Kp5zeTJqtd6QTDWTkDftsQJcmMgT43lViJBqChTTA/oGiXiV62PMKMeMCDaTYNkuZZvLE8Q== gbugaj@localhost