¿Cómo accedo a un repositorio de git en un recurso compartido de 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.

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


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?

preguntado el 01 de febrero de 12 a las 22:02

1 Respuestas

While Git doesn't recognize backslashes, Windows 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 se convierte en /c/Users/bug/repo.

Respondido 02 Feb 12, 02:02

Unfortunately this was the very first thing I tried. I get "fatal: Not a git repository (or any of the parent directories): .git" Also, I can't cd to a share directory from within git bash. Maybe part of the problem? - Charles Randall

Try running that line from a cmd prompt (unless you installed msysgit with the "Git Bash only" option) and/or using file://\\MyWorkPC\etc (with single quotes if using bash). - error

Your original answer was correct. Flaky network may be an explanation for why it wasn't working for me originally. - Charles Randall

The answer is correct. Note that "Not a git repository" may also indicate you're not in a git repository locally (duh!) - Nickolay

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.