Git推送错误“似乎不是git仓库”与文件共享

问题描述:

这似乎应该很简单,但我不能得到这个工作,我到处搜索,但我似乎无法找到答案使用文件共享。当我将本地存储库推送到网络驱动器上的文件共享时,出现错误。下面是我做了什么: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

正如我评论说,这会工作:

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"