Skip to content

Instantly share code, notes, and snippets.

@automatelife
Created July 31, 2015 12:13
Show Gist options
  • Save automatelife/eae78e1a7fb36c853573 to your computer and use it in GitHub Desktop.
Save automatelife/eae78e1a7fb36c853573 to your computer and use it in GitHub Desktop.
Cygwin and SSH

Cygwin and SSH setup

Instructions on setting up cywin to work with ssh.

Why?

The git bash terminal is hard to work with. Having the ability to setup and configure cygwin binaries on other terminals is very helpful for development purposes.

Instructions

  • Navigate to C:\cygwin64\home\<your user>
  • Open the .bashrc with a text editor
  • Add the following to the bottom of the .bashrc file:
#--------SSH Settings-------------
SSH_ENV=$HOME/.ssh/environment
   
# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add
}
   
if [ -f "${SSH_ENV}" ]; then
     . "${SSH_ENV}" > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi

  • Save the file
  • Exit cygwin and reopen
  • Try to clone a repo using git protocol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment