Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用网络驱动器在MacOS X上设置Git存储库_Macos_Git_Network Drive - Fatal编程技术网

使用网络驱动器在MacOS X上设置Git存储库

使用网络驱动器在MacOS X上设置Git存储库,macos,git,network-drive,Macos,Git,Network Drive,给定值: 将我的工作文件夹设置为Git存储库的mac。 网络驱动器(希捷FreeAgent GoFlex Home,如果有帮助的话) 任务: 将网络驱动器上的特定文件夹设置为存储存储库备份的位置 我的尝试: 通过卷路径将位置设置为远程位置(通过Git GUI中的添加远程)-返回: fatal: GIT_WORK_TREE (or --work-tree=<directory>) is not allowed without specifying GIT_DIR (or --git-d

给定值:

将我的工作文件夹设置为Git存储库的mac。 网络驱动器(希捷FreeAgent GoFlex Home,如果有帮助的话)

任务:

将网络驱动器上的特定文件夹设置为存储存储库备份的位置

我的尝试:

通过卷路径将位置设置为远程位置(通过Git GUI中的添加远程)-返回:

fatal: GIT_WORK_TREE (or --work-tree=<directory>) is not allowed without specifying GIT_DIR (or --git-dir=<directory>
在终端中,虽然没有出现错误,但似乎没有结果,因为另一次尝试添加remote结束时出现了与上述相同的错误


之后,我开始怀疑指定通过卷的网络驱动器路径和/或尝试将其添加为远程是否是解决该任务的正确方法。也许还有其他方法可以实现我还不知道的目标?

我假设您会遇到这些错误,因为网络共享中还不存在任何内容。远程存储库必须指向现有存储库,因此您首先必须克隆它:在原始repo中,执行以下操作:

git clone --bare . /Volumes/xxxxxxx/GoFlex_Home/Personal/xxxxxxxx
这将把存储库数据复制到网络文件夹

然后,您可以将其添加为远程:

git remote add --mirror=push backup /Volumes/xxxxxxx/GoFlex_Home/Personal/xxxxxxxx
您将能够与以下两个同步:

git push backup

您是否在网络驱动器中克隆了存储库?
git push backup