在Windows远程计算机上设置Git Server

问题描述

我想在Windows上运行的远程服务器上执行CI / CD,以托管我的VueJs项目。为此,我执行了以下步骤

  1. 我已将本地计算机的ssh作为授权密钥添加到远程服务器,并且可以使用以下命令通过ssh访问admin(cmd)远程服务器。

    ssh remote_server@<ip_address>
    

使用上述命令,git bash将打开cmd,该cmd具有远程服务器的以下位置c:/users/remote_user1,在该位置我已将本地计算机的ssh添加为授权密钥。

  1. 我通过rdp使用以下命令登录远程计算机,从而在C:/users/remote_user1中创建了裸git repo

    git init test.git --bare
    
  2. 我授予了来自远程服务器的test.git的完全访问权限

  3. 我尝试使用git bash中的命令在本地计算机上克隆test.git

    git clone ssh://remoteserver@<ip_address>:/test.git
    

当我从本地计算机使用命令时,我从git bash收到错误消息

fatal: ''/test.git'' 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.

我无法理解我在做什么错,请对此进行指导。

解决方法

ssh网址的格式必须为以下一种:

# 'ssh://' url :
ssh://remoteserver@<ip_address>/test.git

# scp-like syntax :
remoterserver@<ip_address>:test.git

link to docs

您发布的网址包含一个:/,这使其成为两者的混合,您应该修改此网址以匹配两种可接受的格式之一。