tags:

views:

806

answers:

3

Hi all,

I am a complete Noob when it comes to GIT. I have been just taking my first steps over the last few days. I setup a repo on my laptop, pulled down the Trunk from an SVN project (had some issues with branches, not got them working), but all seems ok there.

I now want to be able to pull or push from the laptop to my main desktop. The reason being the laptop is handy on the train as I spend 2 hours a day travelling and can get some good work done. But my main machine at home is great for development. So I want to be able to push / pull from the laptop to the main computer when I get home. I thought the most simple way of doing this would be to just have the code folder shared out across the LAN and do:

git clone file://192.168.10.51/code

unfortunately this doesn't seem to be working for me:

so I open a git bash cmd and type the above command, I am in C:\code (the shared folder for both machines) this is what I get back:

Initialized empty Git repository in C:/code/code/.git/
fatal: 'C:/Program Files (x86)/Git/code' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

How can I share the repository between the two machines in the most simple of ways.

There will be other locations that will be official storage points and places where the other devs and CI server etc will pull from, this is just so that I can work on the same repo across two machines.

As per Sebastian's suggestion I get the following:

C:\code>git clone --no-hardlinks file://192.168.10.51/code
Initialized empty Git repository in C:/code/code/.git/
fatal: 'C:/Program Files (x86)/Git/code' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

*EDIT - ANSWER *

Thanks to all that helped. I tried the mapping a drive and that worked so thought I would go back and retry without mapping. The final result was:

git clone file://\\\\192.168.0.51\code

This worked great.

Thanks

+1  A: 
$ git clone --no-hardlinks /path/to/repo

The above command uses POSIX path notation for the directory with your git repository. For Windows it is (directory C:/path/to/repo contains .git directory):

C:\some\dir\> git clone --local file:///C:/path/to/repo my_project

The repository will be clone to C:\some\dir\my_project. If you omit file:/// part then --local option is implied.

J.F. Sebastian
+3  A: 

Maybe map the share as a network drive and then do

git clone Z:\

Mostly just a guess; I always do this stuff using ssh. Following that suggstion of course will mean that you'll need to have that drive mapped every time you push/pull to/from the laptop. I'm not sure how you rig up ssh to work under windows but if you're going to be doing this a lot it might be worth investigating.

intuited
+1  A: 

This worked for me:

git clone file:////<host>/<share>/<path>

edit: For example, if your main machine has the IP 192.168.10.51 and the computer name main, and it has a share named code which itself is a git repository, the both of the following commands should work equally:

git clone file:////main/code
git clone file:////192.168.10.51/code

If the git repository is in a subdirectory, simply append the path.

poke
is there a way to authenticate (ie username/password) with that scheme?
intuited
Hi that was almost there, I have editted my question to show final resul
Jon
@intuited: I don't think so, but the authorization request might pop up automatically. Or you have to open the share manually first (in Windows Explorer), as Windows saves the authorization during a session.
poke