How to git clone a repo in windows from other pc within the LAN?

Kou picture Kou · Mar 4, 2011 · Viewed 46.2k times · Source

I have this git repo "c:/xampp/htdocs/**" in my main PC and its IP address is 192.168.0.6. Now I want to git clone this repo from ubuntu-server which running on a Vmware Player in my main PC.

I did

 git clone \\192.168.0.6\c:\xampp\htdocs\****

and

 git clone //192.168.0.6/c:/xampp/htdocs/****

from ubuntu-server and neither worked.

fatal: could not create work tree dir '****'.: Permission denied

What did I wrong? what should I do?

Answer

Roberto picture Roberto · Sep 23, 2015

You should use the command git daemon to host your repo, like this:

In your computer that will act as a server:

git daemon --base-path=<path_to_folder_containing_project_folder> --export-all

(please note that path_to_folder_containing_project is the folder containing your projects folders, it will provide all projects under that folder)

In your client:

git clone git://<local ip>/<project name>

The cloned repo will have its origin pointing to the server in your LAN, so you may want to use git remote set-url origin to point it to the original origin.

You may want to run git daemon with the --verbose option to get more details in case you run into problems.