Git推送错误"似乎不是一个git存储库"与fileshare

时间:2014-11-04 22:52:33

标签: git fileshare

这似乎应该很简单,但我无法让它工作,我已经到处搜索,但我似乎无法使用文件共享找到答案。当我将本地存储库推送到网络驱动器上的文件共享时,我收到错误。这就是我所做的:

//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.

我在这里做错了什么?提前谢谢。

1 个答案:

答案 0 :(得分: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

或使用与&#34; GIT clone repo across local file system&#34;:

相同的解决方案
git remote add origin file://"H:/path_with spaces/test.git"