27

My colleagues and I are thinking of giving git a try and see if we can easily move to it. We work on a Windows-only environment. On our own machines we already have git set up with mingw32 and SmartGit as gui client.

Is there an easy approach based more on the concept of sharing folders than on the concept of "hosting server"? For example, we wanted to host a git repository on a folder shared on the lan, clone it on our machines and see how to push our changes back to that folder, merge them and so on.

Our first problem was cloning from the lan. Of course git doesn't recognize paths like \\mymachine\shared\repo

How to start with our approach? Is to doable? Any advice?

Thanks in advance.

EDIT

As suggested, a command line approach worked. We also had to invert the slashes, so that git clone //machine/directory/repository did the trick. Now, my colleague had a local copy working, made some changes... How to push them back to the shared folder?

Push and Fetch work on local paths too, we're up and running with our tests. Thank you all!

pistacchio
  • 56,889
  • 107
  • 278
  • 420
  • 1
    in response to your edit, `git push` on the command line with the remote repository specified should get you the push functionality you're looking for. – Kit Roed Feb 09 '10 at 16:54
  • Pistacchio, Please share with me the actual setup you have, coz am trying the same thing but its failing. – gath Feb 25 '10 at 11:27

5 Answers5

19

For a pure command-line solution, did you try

 git clone file:///local/path/to/repo-name.git

In your case:

 git clone file:///\\mymachine/shared/repo.git

It should work just fine.


Update August 2014 (4 years later), Git 2.1

Commit c2369bd by Eric Sunshine and Cezary Zawadka (czawadka) means a simpler UNC path now work:

Windows: allow using UNC path for git repository

Eric Sunshine fixed mingw_offset_1st_component() to return consistently "foo" for UNC "//machine/share/foo", cf this thread.

So this should now work:

git clone //mymachine/shared/repo.git
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
11

We use TortoiseGit. The URL's it accepts are //machinename/shared/repo.

Joel Lucsy
  • 8,520
  • 1
  • 29
  • 35
  • 1
    Plain Git should accept URLs such as these without issue as well. Failing that, another possible approach might be to have every team member map the shared folder to a chosen drive letter (e.g. X:) and use that instead. – Mark Embling Feb 09 '10 at 16:25
1

My advice sidesteps your efforts a bit, but I've been using Mercurial in exactly the same approach you've described here, and if it's not too much of a plan change, I'd encourage you to give using TortoiseHg a try. Mercurial works with file path based repositories exactly the same way it works with "served" repositories (e.g. it will recognize \\server\shared_repo\repo_path as a valid repository path to clone from.)

As an additional point, from what I can tell, Mercurial's Windows support is pretty far along, whereas git still has some fringe compatibility issues (although it appears that you've addressed many of the biggest challenges to using git on Windows already)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Kit Roed
  • 5,167
  • 5
  • 30
  • 34
  • 1
    I wanted to quickly add the comment that this answer is quite old (and bad because I didn't answer the *question*). I'm upvoting the top voted answer to acknowledge the better answer. – Kit Roed Mar 02 '15 at 14:07
1

My post has a step by step guide to creating a distributed git repository using a windows share. I've found that a windows share works fine for small projects.

http://www.dalsoft.co.uk/blog/index.php/2011/08/30/getting-started-with-git-on-windows/#Creating_a_distributed_repository

DalSoft
  • 10,673
  • 3
  • 42
  • 55
0

"I have a few different computers that I use at home and I wanted to set up GIT that I can access my code from any of them. It took me a bit because I was too used to working with a client-server model where I designate one machine as the "server" that holds the repository and everything else was a client. Instead, GIT seems to operate more like a merge tool and every local copy is its own "master." Once I understood that, it turns out that setting up GIT is very simple and just needs GIT itself and SSH".

To read more you can check this link: http://blog.lazyhacker.com/2010/04/setting-up-git-for-home-network.html

Rayan Elmakki
  • 1,144
  • 13
  • 7