Last active
August 2, 2018 14:53
-
-
Save 2ajoyce/9a82fb6858d262055981ebcc94d0de54 to your computer and use it in GitHub Desktop.
Bash Profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SSH Agent | |
| # Note: ~/.ssh/environment should not be used, as it | |
| # already has a different purpose in SSH. | |
| # source : https://www.schoonology.com/technology/ssh-agent-windows/ | |
| env=~/.ssh/agent.env | |
| # Note: Don't bother checking SSH_AGENT_PID. It's not used | |
| # by SSH itself, and it might even be incorrect | |
| # (for example, when using agent-forwarding over SSH). | |
| agent_is_running() { | |
| if [ "$SSH_AUTH_SOCK" ]; then | |
| # ssh-add returns: | |
| # 0 = agent running, has keys | |
| # 1 = agent running, no keys | |
| # 2 = agent not running | |
| ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ] | |
| else | |
| false | |
| fi | |
| } | |
| agent_has_keys() { | |
| ssh-add -l >/dev/null 2>&1 | |
| } | |
| agent_load_env() { | |
| . "$env" >/dev/null | |
| } | |
| agent_start() { | |
| (umask 077; ssh-agent >"$env") | |
| . "$env" >/dev/null | |
| } | |
| add_all_keys() { | |
| # ls ~/.ssh | grep ^id_rsa.*$ | sed "s:^:`echo ~`/.ssh/:" | xargs -n 1 ssh-add C:\Users\ajoyce.VHACORP\.ssh\vms | |
| ssh-add C:/Users/ajoyce.VHACORP/.ssh/id_rsa | |
| ssh-add C:/Users/ajoyce.VHACORP/.ssh/vms | |
| } | |
| if ! agent_is_running; then | |
| agent_load_env | |
| fi | |
| # if your keys are not stored in ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub, you'll need | |
| # to paste the proper path after ssh-add | |
| if ! agent_is_running; then | |
| agent_start | |
| add_all_keys | |
| elif ! agent_has_keys; then | |
| add_all_keys | |
| fi | |
| echo `ssh-add -l | wc -l` SSH keys registered. | |
| unset env | |
| alias g='git' | |
| alias gs='git status' | |
| alias gpr='git pull --rebase' | |
| alias dn='dotnet' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment