Skip to content

Instantly share code, notes, and snippets.

@vlsulliv
Last active May 13, 2023 18:14
Show Gist options
  • Save vlsulliv/c604757b94bca25ef3461f09f5ab03b2 to your computer and use it in GitHub Desktop.
Save vlsulliv/c604757b94bca25ef3461f09f5ab03b2 to your computer and use it in GitHub Desktop.
Bash Profile
# generated by Git for Windows
if test -f ~/.bashrc && . ~/.bashrc; then
fi
if echo $PATH | grep -v $HOME/bin > /dev/null; then
export PATH="$HOME/bin:$PATH"
fi
# =======================
# Auto-launching ssh-agent on Git for Windows
# You can run ssh-agent automatically when you open bash or Git shell. Copy the following lines and paste them into your ~/.profile or ~/.bashrc file in Git shell:
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
# =======================
## CAUTION - DELETE CONFIRMATION
rm -rf *.zzy ## The "-rf" options to "rm" are very dangerous,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment