2011-04-20 56 views
4

我想通過克隆工作桌面上存在的git存儲庫到我的筆記本電腦,在家工作。這兩個系統都在cygwin shell中運行msysgit。這兩個系統都使用cygwin的ssh。'X'似乎不是git倉庫(我敢肯定路徑是正確的)

如果我ssh到該服務器,我可以看到倉庫處的路徑/ cygdrive/d /項目/ TheProject

$ ssh TheDesktop 
[email protected]'s password: ...I enter the password, see the MOTD, and I'm in... 
$ cd /cygdrive/d/Projects/TheProject 
...See the git repository here. Even see the current branch in the prompt... 

但我嘗試克隆和失敗:

$ git clone ssh://TheDesktop/cygdrive/d/Projects/TheProject 
Cloning into TheProject 
[email protected]'s password: ...I enter the password... 
fatal: '/cygdrive/d/Projects/TheProject' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly 

我也試着將系統信息庫符號鏈接到我的個人文件夾:

$ ssh TheDesktop 
[email protected]'s password: ...I enter the password... 
$ ln -s /cygdrive/d/Projects/TheProject . 
$ exit 

$ git clone ssh://TheDesktop/~/TheProject 
Cloning into TheProject 
[email protected]'s password: ...I enter the password... 
fatal: '/cygdrive/d/Projects/TheProject' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly 

我當然在很多問題上看到這個錯誤在這裏,他們幾乎總是關係到一條糟糕的道路。但我確定我的路徑是正確的。我感覺到它與桌面上的環境有關,但我真的無法弄清楚什麼。還有什麼其他的東西會導致這個錯誤

回答

4
git clone TheDesktop:cygdrive/d/Projects/TheProject TheProject 

應該修復它

,替代Windows路徑:

cygpath --mixed /cygdrive/d/Projects/TheProject 

據我的經驗cygwin將錯誤的路徑樣式傳遞給msysgit。 Msysgit不理解/ cygdrive,因此將其混淆,,除了在命令行上有一個參數,在這種情況下,cygwin bash似乎以神奇的方式進行轉換。

然而,對於cygwin sshd而言,這種情況不會發生在gitshell上。我假設你試過了接近

git clone TheDesktop:D:/Projects/TheProject TheProject 

如果沒有工作,我想看看

git daemon # wasn't supported on Windows last time I checked 

git bundle create repo.bundle --all 

# receive it on the remote 
scp TheDesktop:repo.bundle 
git clone repo.bundle TheProject 
+0

更多疑難解答提示 – sehe 2011-04-20 15:48:03

+0

我需要使用D:/ Projects/TheProject路徑而不是cygwin ssh路徑。非常感謝你! – 2011-04-20 15:54:14

+0

很高興幫助(我很快就可以使用這些知識!) – sehe 2011-04-20 16:14:39

1

你需要克隆庫本身,而不是相關的工作樹:

$ git clone ssh://TheDesktop/cygdrive/d/Projects/TheProject/.git TheProject 

應該工作

+0

謝謝,但我仍然得到同樣的錯誤。 – 2011-04-20 14:23:31

0

與混帳想找到「cygdrive/d /項目/ TheProject它可能不得不做「相對於您的登錄文件夾。

在你的第一個例子中,你通過ssh登錄,然後執行「cd/cygdrive/...」,這是一個絕對路徑,而不是相對路徑。

更改您的ssh登錄文件夾以指向例如項目文件夾可能會幫助你。而且還縮短你的ssh路徑:)如果SSH服務器在Cygwin的不

+0

好的,所以我ssh到桌面和ln -s/cygdrive/d/Projects/TheProject到主目錄中。然後「git clone ssh:// TheDesktop /〜/ TheProject」。我仍然得到同樣的錯誤。我會將其添加到OP中。 – 2011-04-20 15:34:37

相關問題