2013-06-24 16 views
1

我已经在bitbucket中设置了一个帐户。 按照这里给出的步骤, https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Gitgitbash错误 - sh.exe SSH_ENV模糊重定向

在步骤6.5,当我重新打开gitbash,它提供了以下错误,

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. 

我猜想的空间的问题在目录路径,但不知道如何修复它..

回答

2

为防万一你还没有解决这个问题,请确保你已经正确地复制并粘贴了上一步(6.3)中的行。间距和缩进很重要,所以如果粘贴到文本编辑器中会造成混乱,那可能是导致问题的原因。

+0

了这个问题,在Git的Bash shell中六。从bitbucket复制到Scite,然后复制到vim。在Scite&vim中启用了空白可见性并注意到了选项卡。在Scite中清理,重新安装并运行。谢谢。 – bvj

4

你是对的,因为它是目录路径中的空间问题。解决它的方法是打开.bashrc文件和环绕$ {} SSH_ENV加上引号,如下面的代码所示:

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 
1

DO:保存的.bashrc为UTF-8。

DO NOT:保存的.bashrc为ANSI(会导致错误。)

************* 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... 
+0

不知何故,它真的很重要 - 没有BOM的** UTF8 ** – marrriva