2014-11-04 58 views
1

這似乎應該很簡單,但我不能得到這個工作,我到處搜索,但我似乎無法找到答案使用文件共享。當我將本地存儲庫推送到網絡驅動器上的文件共享時,出現錯誤。下面是我做了什麼:Git推送錯誤「似乎不是git倉庫」與文件共享

//Create The repository: 
cd H:/ 
git init --bare --shared=group test.git 
//Have also tried git init --bare test.git 

然後,我創建一個本地資源庫:

cd MyDocuments/Test 
git init 
git add . 
git commit -m "Initial Commit" 
git remote add origin 'H:/test.git" 
//Have also tried (among many others): 
git remote add origin 'file:///fileshare/test.git' 

然後我得到這個錯誤:

$git push origin master 
fatal: '\fileshare\test.git' does not appear to be a git repository 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists. 

什麼我錯在這裏做什麼?提前致謝。

+0

您是否嘗試過沒有引號? 'git remote add origin H:/ test.git' – VonC 2014-11-05 09:53:00

+0

This worked!但是,我首先引用引號的原因是我的實際項目在路徑名中有一個空格,當然,這不會將存儲庫作爲遠程添加,只會給我一個使用錯誤。我如何添加在路徑中有空格的存儲庫? – user1322194 2014-11-05 15:24:00

+0

我在下面的答案中提出了一些處理空間的方法。 – VonC 2014-11-05 15:28:24

回答

0

正如我評論說,這會工作:

git remote add origin H:/test.git 

對於帶有空格的路徑,你可以嘗試不同的逃生計劃:

git remote add origin H:/path_with\ spaces/test.git 
git remote add origin "H:/path_with spaces/test.git" <=== 
git remote add origin H:/path_with^ spaces/test.git 

,或使用相同的解決方案,如 「GIT clone repo across local file system」:

git remote add origin file://"H:/path_with spaces/test.git"