来自 vps 的 git clone

tim*_*agh 1 git ssh vps

我在克隆我的存储库时遇到了一些问题

$git clone ssh://root@8x.12x.9x.21x:/repo repo
Cloning into 'repo'...
fatal: '/repo' 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.
Run Code Online (Sandbox Code Playgroud)

虽然我在克隆 vps 本身时没有遇到这样的麻烦。我也没有从另一台计算机推送到它的问题。

$ ssh root@8x.12x.9x.21x
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 2.6.32-042stab111.11 x86_64)

* Documentation:  https://help.ubuntu.com/
Last login: Tue Mar  8 12:29:47 2016 from 80.79.35.115
root@vps:~# ls
deployment_test  my-project  repo
root@vps:~# git clone repo repo2
Cloning into 'repo2'...
done.
Run Code Online (Sandbox Code Playgroud)

有谁知道可能是什么问题?

Gre*_*con 6

git clone ssh://root@8x.12x.9x.21x:/root/repo
Run Code Online (Sandbox Code Playgroud)

您可以省略冒号,因为您使用的是标准端口。

git clone ssh://root@8x.12x.9x.21x:/root/repo
Run Code Online (Sandbox Code Playgroud)

为了完整起见,SSH 克隆 URL 也可以像

git clone root@8x.12x.9x.21x:/root/repo
Run Code Online (Sandbox Code Playgroud)

或者使用相对路径,因为它位于 root 的主目录中。

git clone root@8x.12x.9x.21x:repo
Run Code Online (Sandbox Code Playgroud)