Skip to content

Windows Gitbash setup

K.Sriram edited this page Dec 15, 2021 · 3 revisions

Install gitbash to use Mingw rather than windows cmd

bashrc

Add below code to /etc/bash.bashrc

This enables easy to use ssh key management for passwordless authentication.

To any remote linux machine you can use setup_ssh <userid>@<remoteip> to share the keys.

create_pkeys ()
{
    cd ~;
    ssh-keygen -t rsa;
    cd -
}

setup_ssh ()
{
        if [ ! -f ~/.ssh/id_rsa.pub ]; then
                create_pkeys;
        fi;
        cd ~;
        TERM=xterm-256color ssh -o ServerAliveInterval=60 $@ mkdir -p .ssh;
        cat .ssh/id_rsa.pub | TERM=xterm-256color ssh -o ServerAliveInterval=60 $@ 'cat >> .ssh/authorized_keys';
        TERM=xterm-256color ssh -o ServerAliveInterval=60 $@ "chmod 700 .ssh; chmod 640 .ssh/authorized_keys";
        cd -
}

get_nerdfonts()
{
	git clone --depth 1 https://github.com/ryanoasis/nerd-fonts.git
	if [ -d ./temp ];then
		rm -rf ./temp/*
	else
		mkdir temp
	fi
	for i in $(find ./nerd-fonts/patched-fonts -name "*.ttf" -o -name "*.otf"|sed -e 's/ /___/g')
	do
		src=$(echo $i | sed -e 's/___/\ /g')
		echo $src
		cp "$src" ./temp/
	done
        rm -rf nerd-fonts
        mv temp nerdfonts
}

export DISPLAY=localhost:0

alias ssh="ssh -XYC"
alias sbash="source /etc/bash.bashrc"

After updating bashrc close and reopen GitBash

Install Fonts

Install nerd fonts from

  • (Github)[https://github.com/ryanoasis/nerd-fonts/releases]
  • NerdFonts (Website)[https://www.nerdfonts.com/]

I prefer FantasqueSansMono Nerd Font

Install all fonts

  • Open GitBash and run get_nerdfonts this creates nerdfonts directory
  • Open Font Settings from start menu
  • Open Windows explorer and go to the path where nerdfonts directory created
  • Drag and drop nerdfonts directory to Font Settings window

GitBash UI Settings

Access GitBash Options

from titlebar -> right click -> options

Font selection

Options -> Text -> Change font to some nerd font

Set Ctrl+Mouse to send all mouse events to Gitbash instead of application running inside Gitbash

Options -> Mouse -> Application mouse mode -> Modifier for overriding default -> select Ctrl

Install and use emojis

In Git Bash Copy https://raw.githubusercontent.com/wiki/mintty/mintty/getemojis to /usr/bin/ if not exist already

  • Navigate to C:\Program Files\Git\usr\share\mintty\emojis
  • Run getemoji -d
  • Run getemoji .
  • Copy the images from 1 into apple

Select emojis from GUI Options -> Text -> Emojis

Clone this wiki locally