jay@server:~$ git clone ssh://jay@xxx.xxx.xxx.xxx/tinyos/tinyos-2.x
Cloning into tinyos-2.x...
Password:
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
奇怪了,居然無法下載Mac上的資料,原來是path出了問題,apple為了一些安全的考量,所以預設路徑只會有/usr/bin、/usr/sbin、/bin和/sbin,所以,建立連線之後,會找不到git-upload-pack的路徑。我們可以使用以下指令查看遠端伺服器的path:
jay@server:~$ ssh jay@xxx.xxx.xxx.xxx echo \$PATH
Password:
/usr/bin:/bin:/usr/sbin:/sbin
所以如果不想更改path的話可以用-u的參數,指定git-upload-pack的位置:
git clone -u /usr/local/git/bin/git-upload-pack ssh://jay@xxx.xxx.xxx.xxx/tinyos/tinyos-2.x tinyos-2.x
當然如果不想每次連線都打這麼長的參數,可以將/usr/local/git/bin/底下的所有檔案,在/usr/bin/建立連接:
cd /usr/bin/
sudo ln -s /usr/local/git/bin/git* .
如此一來,就一切正常啦~~
參考來源:
http://stackoverflow.com/questions/225291/git-upload-pack-command-not-found-how-to-fix-this-correctly
http://pencilcasestudios.github.com/article/2009/04/03/when-git-clone-does-not-work-on-mac-os-x/
沒有留言:
張貼留言