1

I have setup a account in bitbucket. As per the steps given here, https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

In step 6.5, when I reopen the gitbash, it gives following error,

Welcome to Git (version 1.8.1.2-preview20130201)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
sh.exe": /c/Documents: No such file or directory
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Initializing new SSH agent...
sh.exe": ${SSH_ENV}: ambiguous redirect
succeeded
chmod: getting attributes of `/c/Documents': No such file or directory
chmod: getting attributes of `and': No such file or directory
chmod: getting attributes of `Settings/vyc/.ssh/environment': No such file or
directory
sh.exe": /c/Documents: No such file or directory
Could not open a connection to your authentication agent.

I guess its the issue of space in dir path, but not sure how to fix it..

Daniel Daranas
  • 21,689
  • 9
  • 60
  • 108
Vijay C
  • 4,459
  • 1
  • 39
  • 46

3 Answers3

4

You are correct in that it is an issue of space in the dir path. The way to fix it is to open up the .bashrc file and surround ${SSH_ENV} with quotes like the following code shows:

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
shizbiz
  • 497
  • 1
  • 6
  • 9
2

Just in case you haven't solved this yet, make sure that you have correctly copied and pasted the lines from the previous step (6.3). The spacing and indentation matters, so if pasting into your text editor messed it up, that could be what is causing the problem.

  • Had this problem with vi in the Git Bash shell. Copied from bitbucket into Scite, then into vim. Enabled whitespace visibility in both Scite & vim and noticed the tabs. Cleaned up in Scite, repasted, and it worked. Thanks. – bvj Jan 18 '17 at 19:45
1

DO: Save .bashrc as UTF-8.

DO NOT: Save .bashrc as ANSI (WILL CAUSE ERROR.)

************* ERROR LOOKS LIKE THIS ***********
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
sh.exe": /c/Documents: No such file or directory
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Initializing new SSH agent...