Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 318
Kou Avatar asked Mar 04 '11 22:03

Kou


People also ask

How do I access a git repository from another computer?

in CMD go to folder where you want your app to be cloned to, for example cd C:/my_apps/ login to github and go to app you want to clone, press green button "Clone or Download", you will see SSH link, copy it. in CMD run git clone [email protected]:user/my-app. git (use SSH link you copied)


2 Answers

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.

like image 150
Roberto Avatar answered Sep 19 '22 08:09

Roberto


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 
like image 26
ralphtheninja Avatar answered Sep 20 '22 08:09

ralphtheninja