0 votes
1 view
in Devops and Agile by (22k points)

I am a complete Noob when it comes to GIT. I have been just taking my first steps over the last few days. I set up 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 traveling 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?

I have tried with the help of the internet I got 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

1 Answer

0 votes
by (37.6k points)

You can specify the url using the Universal Naming Convention(UNC) path to the file protocol by using:

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

Here you need to use four slashes ‘////

If the git repository is in the subdirectory then use these commands:

git clone file:////main/code/project-repository

git clone file:////<ip>/code/project-repository

These will help you to clone repo across the local system in windows.

...