1

我有 ubuntu 在 IP 地址为 192.168.0.92 的虚拟机客户机上运行,​​我可以从运行 Windows 7 的主机 ping 这台计算机。我也可以从 ubuntu ping 到 windows 的另一种方式。

在 ubuntu 中,我创建了一个像这样的裸存储库:

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

在我的 Windows 7 主机上,我在 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.

我看到了 ssh 错误,所以我想我可能必须指定 git 协议,所以尝试了:

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

我需要在克隆命令中指定什么路径?我怎样才能得到这个工作?

4

1 回答 1

1

您必须git-daemon知道它可以为您的回购服务:

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

然后在您的客户端上,使用以下命令克隆存储库:

$ git clone git://192.168.0.92/myexample.git
于 2021-07-12T12:36:31.183 回答