如何访问 Windows 共享上的 git 存储库? [英] How do I access a git repo on a windows share?

查看:52
本文介绍了如何访问 Windows 共享上的 git 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够将工作存储库从我的 Windows 7 桌面同步到我的 Windows 7 笔记本电脑,而无需将我的提交推送到我们的主服务器.我该怎么做呢?我不知道如何设置远程路径,以便 git 可以了解它的位置.我通常使用 Git Bash 来处理 git,而不是 windows 命令行,所以这里的问题很可能是我无法弄清楚如何在 Git Bash 中编写一个引用 windows 共享的路径.

I want to be able to sync a work repo from my Windows 7 desktop to my Windows 7 laptop without pushing my commits to our main server. How do I do this? I can't figure out how to set up a remote path so that git can understand where it is. I generally use Git Bash for dealing with git, not the windows commandline, so the issue here is likely that I can't figure out how to write a path in Git Bash which will reference a windows share.

所以,假设我在(windows 共享路径)有一个 repo:

So, say I have a repo at (windows share path):

\\MyWorkPCNamedevmyrepo

在命令行中,我可以访问目录和文件(尽管使用 pushd,因为 cmd 很愚蠢),如何将其转换为有效的 git 远程?

And in the command line, I can access the directories and files (albeit using pushd since cmd is stupid), how do I convert this in to a valid git remote?

推荐答案

虽然 Git 不识别反斜杠,但 Windows 可以识别正斜杠:

While Git doesn't recognize backslashes, Windows does recognize forward slashes:

git remote add desktop //MyWorkPCName/dev/myrepo

Git Bash 还允许您使用 UNIX 样式的路径访问 Windows 驱动器,例如C:Usersug epo 变为 /c/Users/bug/repo.

Git Bash also lets you access windows drives using UNIX-style paths, e.g. C:Usersug epo becomes /c/Users/bug/repo.

这篇关于如何访问 Windows 共享上的 git 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆