How to git clone bare remote git repository on another host

350 Views Asked by At

I have ubuntu running on a virtual box guest with IP address 192.168.0.92 and I can ping this computer from my host running Windows 7. I can also ping the other way from ubuntu to windows.

In ubuntu I created a bare repository like this:

angus@angus-VirtualBox:~/Documents/Courses/oss/play$ git init --bare myexample.git
Initialised empty Git repository in /home/angus/Documents/Courses/oss/play/myexample.git/
angus@angus-VirtualBox:~/Documents/Courses/oss/play$ git daemon&
[1] 2790

On my Windows 7 host I ran these commands in git bash:

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ git clone 192.168.0.92:myexample.git
Cloning into 'myexample'...
ssh: connect to host 192.168.0.92 port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ git clone 192.168.0.92:myexample.git
Cloning into 'myexample'...
ssh: connect to host 192.168.0.92 port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ git clone 192.168.0.92:/home/angus/Documents/Courses/oss/myexample.git
Cloning into 'myexample'...
ssh: connect to host 192.168.0.92 port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I saw the ssh error so thought I might have to specify the git protocol so tried:

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ git clone 
git://192.168.0.92/home/angus/Documents/Courses/oss/play/myexample.git/
Cloning into 'myexample'...
fatal: remote error: access denied or repository not exported: 
/home/angus/Documents/Courses/oss/myexample.git

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ git clone git://192.168.0.92:myexample.git
Cloning into 'myexample'...
fatal: No path specified. See 'man git-pull' for valid url syntax

What path do I need to specify in the clone command? How can I get this working?

1

There are 1 best solutions below

0
On BEST ANSWER

You'll have to let git-daemon know it can serve your repo:

$ git init --bare myexample.git
$ git daemon --verbose --base-path=. --export-all &

Then on your client, clone the repo with:

$ git clone git://192.168.0.92/myexample.git