UNC 路径上的 git
我的电脑装有Windows XP,没有互联网连接,只能访问网络驱动器。我想在网络驱动器上设置一个 git 存储库,然后从本地存储库推送到它,这样我就可以在一天结束时转到具有 Internet 连接的计算机并从网络驱动器推送到 github。
我的问题是我无法从 git 访问网络驱动器。我将 PortableGit 放在网络驱动器上,但 git-bash.bat 和 git-cmd.bat 因“CMD 不支持 UNC 路径作为当前目录”而死亡。我尝试在 git-cmd.bat 中将“cd”替换为“pushd”,但它不起作用。
顺便说一句,我使用 PortableGit 因为我的机器没有管理员权限。
有什么想法吗?
I have computer with Windows XP and no Internet connection, only access to network drive. I'd like to set up a git repository on the network drive and then push to it from my local repository, so I can at the end of the day go to a computer with Internet connection and push from network drive to github.
My problem is I cannot access network drive from git. I put PortableGit on the network drive, but git-bash.bat and git-cmd.bat die with "CMD does not support UNC paths as current directories.". I tried replacing "cd" with "pushd" in git-cmd.bat, but it doesn't work.
BTW, I use PortableGit since I don't have admin permissions on my machine.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这对我有用:
This worked for me:
只需使用 UNC 路径 -
git
不关心cmd
可以做什么和不能做什么。旧答案:将 UNC 路径绑定到驱动器号(或使用目录符号链接)。
Just use the UNC path -
git
doesn't care whatcmd
can and cannot do.Old answer: Bind the UNC path to a drive letter (or use a directory symlink).
首先打开 Windows 控制台,运行 -> cmd
现在您应该能够“cd”驱动器上的所有目录。您也可以选择输入
git init --bare nameOfnewRepo.git 某处。
现在打开 git bash 并 cd 到网络驱动器上要克隆存储库的位置
请注意,在 git bash 中斜杠向前,在 Windows 控制台中向后。
First open a windows console, Run->cmd
now you should be able to 'cd' through all the directories on the drive. Optionally you can type a
git init --bare nameOfnewRepo.git
somewhere.Now open git bash and cd to the location where you want to clone the repo on the network drive
Note that in git bash the slashes are forward and in the windows console backward.
正如 Konstantin 所说,“//comp1/Proj/git/SDK/”作为 UNC 路径可以正常工作。
其他人提到使用远程文件系统的性能很差,我无法重现。通过加密的 VPN 文件系统访问克隆相同的存储库需要 3 分钟 45 秒,通过未加密的 HTTP(Bonobo Git 服务器)克隆相同的存储库需要 3 分钟 25 秒。
用于存储库访问的安全通道 + Windows 身份验证当然值得额外支付 10%。
请注意,Cygwin 的“git”命令不适用于此远程路径。与 GitExtensions 捆绑在一起的 git.exe 可以正常工作,VS2015 也可以正常工作。
As Konstantin said, "//comp1/Proj/git/SDK/" works fine as a UNC path.
Others mentioned poor performance using a remote file system, which I cannot reproduce. Cloning the same repo took 3min45 through encrypted VPN file system access and 3min25 through unencrypted HTTP (Bonobo Git Server).
The secure channel + windows authentication for repo access is certainly worth the extra 10%.
Note that Cygwin's "git" command does not work with this remote path. The git.exe that comes bundled with GitExtensions works fine, VS2015 works fine too.
msysGit 邮件列表(以及当它处于活动状态时,问题跟踪器)上讨论了类似(但不完全相同)的问题。虽然该问题与 UNC 的“Git bash here”功能有关,但解决方案可能类似。也许其中一些链接可以帮助您找到解决方案:
如果您找到解决方案,请考虑将修复提交回 msysGit 项目:)
There's a similar (but not quite the same) issue discussed on the msysGit mailing list (and back when it was active, the issue-tracker). While that issue is about the "Git bash here"-feature from UNC, the solution might be similar. Perhaps some of these links will help you find a solution:
And if you find a solution, please consider to submit the fix back to the msysGit project :)
检查您是否确实有权访问本地驱动器。将其安装在那里将是最简单的解决方案。
Check if you actually have access to your local drive. Installing it there would be the easiest solution.
似乎有一个寄存器值允许在 cmd 上使用 UNC 路径。您可以通过在 cmd 上运行以下命令来设置寄存器:
来源
It seems that there is a register value that allows to use UNC paths on cmd. You can set up the register by running this on cmd:
Source