To start off, I am on the 64-bit version of Windows 10.
After positing the follow code into my .bashrc file:
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;
fiAnd then restarting Git Bash, I get a bash message stating:
bash: [-f/c/Users/<user>/.ssh/environment]: No such file or directory Initializing new SSH agent... succeeded bash: ./c/Users/Nick/.ssh/environment: No such file or directory Could not open a connection to your authentication agent.
When I check ~/.ssh I see I have the 'environment' in there. The file's contents are:
SSH_AUTH_SOCK=/tmp/ssh-YPNbq3XWRqJ8/agent.10808; export SSH_AUTH_SOCK; SSH_AGENT_PID=7904; export SSH_AGENT_PID; #echo Agent pid 7904;
I'm guessing the script is trying to find /dev/null or /usr/bin/ssh-add and failed. Neither of those are located in my $HOME directory. I'm guessing those paths are for setting up SSH for Git on linux as well. Should I be pointing to another directory? Thanks in advance.
Add this code to .bash_profile worked for me.
From http://stackoverflow.com/questions/18880024/start-ssh-agent-on-login
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.