Skip to content

Instantly share code, notes, and snippets.

@ajai8085
Last active March 30, 2022 03:24
Show Gist options
  • Save ajai8085/d564f13feaeaaf33fbc563af3db91c4a to your computer and use it in GitHub Desktop.
Save ajai8085/d564f13feaeaaf33fbc563af3db91c4a to your computer and use it in GitHub Desktop.
cmdr conemu git prompt as admin
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not
running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
agent_start
ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
ssh-add
fi
unset env
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
source $HOME/.bash-git-prompt/gitprompt.sh
fi

Windows 10 Git setup

  1. Dowload and install git for windows https://git-scm.com/downloads
  2. Download cmdr mini from http://cmder.net/ and unzip to a safe location

Setup cmdr

Icon file /icon "C:\Program Files\Git\mingw64\share\git\git-for-windows.ico" Command C:\Program Files\Git\usr\bin\bash.exe --login -i -new_console:a

Setup Git ssh

Follow the instructions at to generate ssh and copy the start ssh agent script to .bashrc file and restart the bash to create profile properly.

https://help.github.com/articles/working-with-ssh-key-passphrases/

  1. Add .bashrc file and insert contents at https://help.github.com/articles/working-with-ssh-key-passphrases/
  2. Open up prompt and clone repo at user's (same folder where .bashrc and .ssh folders are created during above operation) folder git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
  3. Edit .bashrc file one more time and add the line at the end of file GIT_PROMPT_ONLY_IN_REPO=1 source ~/.bash-git-prompt/gitprompt.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment