0

我想最终在 Raspberry Pi 上运行 git 服务器,但现在我正在 ubuntu 上进行测试(在 VirtualBox VM 上运行)。我的开发机器是 Windows 7 64 位并运行 Git For Windows v2.32.0.windows.2(最新)。

我在 ubuntu 上设置了 gitserver,如下所示:

git init --bare myexample.git
git daemon --base-path=. --export-all --enable=receive-pack --reuseaddr --informative-errors --verbos -- ./myexample.git

--enable=receive-pack 应该允许推送

我有从 Windows 到 linux 的连接,即我可以双向 ping。

我可以从 ubuntu 成功克隆和推送:

angus@angus-VirtualBox:~/Documents/Courses/oss/client$ git clone git://192.168.0.92/myexample.git
Cloning into 'myexample'...
warning: You appear to have cloned an empty repository.
angus@angus-VirtualBox:~/Documents/Courses/oss/client$ ls
myexample
angus@angus-VirtualBox:~/Documents/Courses/oss/client$ cd myexample/

然后我添加一个文件并提交

angus@angus-VirtualBox:~/Documents/Courses/oss/client/myexample$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 282.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git://192.168.0.92/myexample.git
 * [new branch]      master -> master

但是,当我从 Windows 尝试相同的操作时,我得到:

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'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client
$ cd myexample/

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client/myexample (master)
$ git add .

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client/myexample (master)
$ git commit
[master 9099126] changed hello world to hi guys
 1 file changed, 1 insertion(+), 1 deletion(-)

angus@Angus-PC MINGW64 /d/projects/Coursera/open-source-software-development/gitstuff/client/myexample (master)
$ git push

它只是挂在那里 git push 命令。

我也试过:

$ git remote -v
origin  git://192.168.0.92/myexample.git (fetch)
origin  git://192.168.0.92/myexample.git (push)

我确实找到了这个页面,它表明 msysgit 中有一个错误,但它可以追溯到 2011 年。

https://serverfault.com/questions/142048/git-daemon-on-linux

能够让它发挥作用真是太好了。我不需要 ssh 的安全性,所以只需在受保护的局域网上使用 git 协议就可以了。

在 Windows cmd.exe 中运行似乎更进一步,但仍然挂起:

D:\projects\Coursera\open-source-software-development\gitstuff\client\myexample>git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3)

所以看起来它变得更进一步 - 但如果我检查服务器端,则不会更改回购。

4

0 回答 0