git 从 vps 克隆

git clone from a 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.

虽然我在 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.

有人知道可能是什么问题吗?

使用

git clone ssh://root@8x.12x.9x.21x:/root/repo

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

git clone ssh://root@8x.12x.9x.21x:/root/repo

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

中那样工作
git clone root@8x.12x.9x.21x:/root/repo

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

git clone root@8x.12x.9x.21x:repo