Git 在 LAN 上从 Windows 克隆到 Ubuntu 服务器

Git Clone on LAN from Windows to Ubuntu Server

所以我在 Windows 工作站上从事一个项目已有一段时间,通过 git 跟踪开发情况。现在我需要将所述项目移动到 LAN 上的 Ubuntu 服务器,这已被证明是一个主要的痛苦。我已经使用 SSH 登录到 Ubuntu 服务器,并尝试从 windows 机器克隆项目。但是,我将 运行 保留为相同的错误消息:

fatal: '___' does not appear to be a git repository

fatal: Could not read from remote repository.

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

我尝试了多种协议和 URI 的变体,但结果总是一样的。我不知道出了什么问题,也不知道去哪里寻找参考/获取更多调试信息。任何帮助将不胜感激,因为我真的在这里旋转我的车轮而无处可去。

以下是一些可能相关或不相关的附加要点:

附录: 这是我在 Ubuntu 服务器上使用的命令示例:

git clone --upload-pack "c:/Program\ Files\ \(x86\)/Git/libexec/git-core/git-upload-pack" "ssh://username@ipaddress/cygdrive/c/Users/username/.../projectname.git"

我已经有几个月没有使用 cygwin 了,但我记得在将 msysgit 与 cygwin 一起使用时遇到了问题。我更喜欢使用为 cygwin 打包的 git 版本。

我认为更简单的解决方案是 rsync(或您首选的复制方法)包含您的工作目录和 .git 目录的目录,从 windows 到 ubuntu服务器。

然后在 ubuntu 服务器上,您可以使用 git clone --bare /path/to/rsync'd/directory/ /path/to/new/repo.git

这应该起作用的原因是 .git 目录的内容是 repo。