如何访问 Windows 共享上的 git 存储库?

发布于 2025-01-01 16:53:27 字数 359 浏览 5 评论 0原文

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

所以,假设我在(Windows 共享路径)有一个存储库:

\\\\MyWorkPCName\dev\myrepo\

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

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.

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

\\\\MyWorkPCName\dev\myrepo\

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放低过去 2025-01-08 16:53:27

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

git remote add desktop //MyWorkPCName/dev/myrepo

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

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

git remote add desktop //MyWorkPCName/dev/myrepo

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文