如何在 CPanel 上克隆多个私有仓库
How to clone more than one private repository on CPanel
我在将私有存储库克隆到我的 CPanel 服务器时遇到了一些问题,因为之前克隆了私有 GitHub 存储库。我在使用 ssh 访问之前克隆了它,一切正常。但是,我需要克隆另一个同样私有并使用 ssh 访问的存储库。
我按照所有步骤将私人仓库复制到 CPanel 中,就像上一个一样。但是,我在访问权限方面遇到问题,收到如下相同的消息:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有没有办法用不同的 ssh 密钥克隆两个私有存储库?如何克隆这些存储库而不会收到上面的相同消息?
提前致谢。
---------------------------------------- - - - - - 编辑 - - - - - - - - - - - - - - - - - - - - --------------
我在.ssh文件夹中的配置文件如下
Host region_admin
HostName <git@github.com:SthefanyRangel/regionadmin.git>
User regioye5@cs2006.webhostbox.net:2083
IdentityFile ~/.ssh/id_rsa
Host renovafacil
HostName <git@github.com>
User regioye5@cs2006.webhostbox.net:2083
IdentityFile ~/.ssh/id_rsa.rf
Host regionadmin-ra2
HostName <git@github.com>
User git
IdentityFile ~/.ssh/region_admin
我连接到第二个帐户的尝试是最后一条记录。
阅读文档“CPanel / How to Copy an Account with SSH Keys”后,如果 GitLab 存储库使用与第一个相同的帐户,您可能需要第二个密钥。
如果不行,试试:
git -c core.sshCommand='ssh -Tv' clone git@github:...
这会让您了解考虑了哪些键。如果您的第二个密钥没有默认名称,则需要 ~/.ssh/config
才能指定它。
您可以使用以下方法测试配置条目:
ssh -T region_admin
注意:Hostname
始终只是主机名,而不是 <git@github.com:SthefanyRangel/regionadmin.git>
因此,您的第一个 ~/.ssh/config
条目应该是(对于实际的 GitHub 用户名,已为其注册 public SSH 密钥):
Host region_admin
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
然后:
cd /path/to/regionadmin
git remote set-url origin region_admin:SthefanyRangel/regionadmin.git
我在将私有存储库克隆到我的 CPanel 服务器时遇到了一些问题,因为之前克隆了私有 GitHub 存储库。我在使用 ssh 访问之前克隆了它,一切正常。但是,我需要克隆另一个同样私有并使用 ssh 访问的存储库。
我按照所有步骤将私人仓库复制到 CPanel 中,就像上一个一样。但是,我在访问权限方面遇到问题,收到如下相同的消息:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有没有办法用不同的 ssh 密钥克隆两个私有存储库?如何克隆这些存储库而不会收到上面的相同消息?
提前致谢。
---------------------------------------- - - - - - 编辑 - - - - - - - - - - - - - - - - - - - - --------------
我在.ssh文件夹中的配置文件如下
Host region_admin
HostName <git@github.com:SthefanyRangel/regionadmin.git>
User regioye5@cs2006.webhostbox.net:2083
IdentityFile ~/.ssh/id_rsa
Host renovafacil
HostName <git@github.com>
User regioye5@cs2006.webhostbox.net:2083
IdentityFile ~/.ssh/id_rsa.rf
Host regionadmin-ra2
HostName <git@github.com>
User git
IdentityFile ~/.ssh/region_admin
我连接到第二个帐户的尝试是最后一条记录。
阅读文档“CPanel / How to Copy an Account with SSH Keys”后,如果 GitLab 存储库使用与第一个相同的帐户,您可能需要第二个密钥。
如果不行,试试:
git -c core.sshCommand='ssh -Tv' clone git@github:...
这会让您了解考虑了哪些键。如果您的第二个密钥没有默认名称,则需要 ~/.ssh/config
才能指定它。
您可以使用以下方法测试配置条目:
ssh -T region_admin
注意:Hostname
始终只是主机名,而不是 <git@github.com:SthefanyRangel/regionadmin.git>
因此,您的第一个 ~/.ssh/config
条目应该是(对于实际的 GitHub 用户名,已为其注册 public SSH 密钥):
Host region_admin
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
然后:
cd /path/to/regionadmin
git remote set-url origin region_admin:SthefanyRangel/regionadmin.git