How to git clone a repo in windows from other pc within the LAN?
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.
Using explorer (smb) to mount the remote repository as a network share is the easiest way. I'm not entirely sure, but I think you paths might be wrong. Try file:///192.168.0.6\c:\xampp...
instead.
There are two things that might have gone wrong for you:
- You don't have read permission on the remote repository
- You don't have write permission in the location you want to create your repository ( the current working directory or the directory you specify as second argument to git clone)
And also check if your samba server works for normal file access.
Make sure that your c:/xampp/htdocs folder (or sub folders of it) is shared in windows, so you can navigate on the network by this address:
\\192.168.0.6\htdocs
Then you clone by using file:////. Note that there are four slashes:
git clone file:////192.168.0.6/htdocs/somerepo.git
To access the repo, you must either share it on 192.168.0.6
or must be the same domain user as the one that owns the file on 192.168.0.6
.
If you share the directory on 192.168.0.6
(e.g. with share name myrepo
), you access it with //192.168.0.6/myrepo
.
If you are logged in on your box with a user accout that is known on 192.168.0.6
, you could try accessing the repo through the administrative shares:
//192.168.0.6/c$/xampp/htdocs/...
Always use forward slashes.
Another alternative would be using SSH to access the remote machine.