Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git on a Windows Lan

Tags:

git

windows

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!

like image 943
pistacchio Avatar asked Feb 09 '10 16:02

pistacchio


People also ask

Can git be run locally?

Yes, it is entirely reasonable to use git only locally. You may want to push to a local network drive or removable backup for redundancy reasons, but git itself works perfectly well without connecting to someone else's sever.

Can you run a git server on Windows?

One can download and use it without any restrictions. Follow the steps given below to install Git on a Windows server: 1. Go to https://gitforwindows.org/ and download the latest version of Git.

How do I connect to git on Windows?

Installing Git on Windows Click the Download link to download Git. The download should automatically start. Once downloaded, start the installation from the browser or the download folder. In the Select Components window, leave all default options checked and check any other additional components you want installed.


1 Answers

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 
like image 165
VonC Avatar answered Sep 20 '22 04:09

VonC