如何访问Windows共享上的git repo? [英] How do I access a git repo on a windows share?
问题描述
我希望能够将我的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共享路径):
So, say I have a repo at (windows share path):
\\\\MyWorkPCName\dev\myrepo\
以及在命令行中,我可以访问目录和文件(虽然使用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还允许您访问Windows驱动器使用UNIX风格的路径,例如 C:\ Users \bug\repo
变成 / c / Users / bug / repo
。
Git Bash also lets you access windows drives using UNIX-style paths, e.g. C:\Users\bug\repo
becomes /c/Users/bug/repo
.
这篇关于如何访问Windows共享上的git repo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!