2013-06-24 17 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