gpt4 book ai didi

git - 在 AWS Windows 服务器上托管 Git 存储库

转载 作者:太空狗 更新时间:2023-10-29 14:19:57 26 4
gpt4 key购买 nike

我正在尝试在 AWS Windows Server 实例上托管我自己的私有(private) Git 设置。

这是我的设置:

  • 通过 cygwin 安装 OpenSSH
    • 这行得通。我已经成功通过 SSH 连接到我的服务器
  • 通过 cygwin 安装 Git 守护进程
    • 这似乎可行。我已经使用 Git bash 在本地成功创建和克隆了 repos
  • 出站防火墙规则允许端口 22 和 9418 上的 TCP
  • 传入防火墙规则允许端口 22 和 9418 上的 TCP
    • 我不确定这是必需的。

据我所知,这就是我所需要的,只是我无法克隆存储库。

我正在远程使用这个命令:

git clone ssh://myUser@myServer.com/git/myRepo

我得到了这个输出:

Clone into 'myRepo'
fatal: Could not read from the remote repository

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

但是,当我通过 Git bash 在 myServer 上运行时,完全相同的命令工作正常...这让我相信这是一个防火墙问题。不过,我似乎找不到需要哪个端口。

额外的细节:

  • 我的仓库是使用 git init --bare --shared 初始化的
  • 我的 AWS 实例的安全组 (SG) 具有以下规则(目前用于调试)
    • 入境
      • 端口,来源:ALL 0.0.0.0/0
    • 出站
      • 端口,来源:ALL 0.0.0.0/0

有人知道我错过了什么吗?

谢谢。

最佳答案

您确定“myUser”用户有权访问 /git/myRepo 吗?请注意,这是相对于 root 的,而不是相对于 myUser 的主目录。

如果您希望路径相对于用户的主目录,请尝试格式为 myUser@myServer.com:git/myRepo 的克隆 url。

还要确保在 /git/myRepo 中创建了一个裸仓库 - 即如果你 ls/git/myRepo,你会看到 HEADhooksrefsconfig

关于git - 在 AWS Windows 服务器上托管 Git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18488650/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com