1

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

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

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

4

1 回答 1

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 克隆存储库”中相同的解决方案:

git remote add origin file://"H:/path_with spaces/test.git"
于 2014-11-05T15:28:09.600 回答