git - 多个(超过 1 个)私有 Github 存储库连接到 cpanel - 无法创建第二个 cpanel 存储库
问题描述
我在 Github 中有多个私人仓库。当我尝试设置第二个 cpanel 存储库(使用规定的 Git 版本控制和 SSH 密钥/对配置说明)时,第二个存储库失败并出现可怕的 128 错误:
- 错误:“/usr/local/cpanel/3rdparty/bin/git”结束时报告错误代码“128”:权限被拒绝,请重试。权限被拒绝,请重试。
我的主机帐户上有两个子域(将它们视为“测试”和“产品”),每个子域都指向自己的子文件夹(在 cpanel 文件管理器中),并且每个子域在 Github 中都有自己的私有存储库。第一个子域(测试)效果很好 - 每次都成功地从 Github 向我的网站提供拉取请求。但是当我尝试设置第二个 cpanel 存储库时,会发生上述错误 - 似乎无法动摇这个。
我验证了密钥对配置正确(cat ~/.ssh/id_rsa.pub 和 cat ~/.ssh/id_rsa3.pub),并发现它们正确加载到 cpanel 的 .ssh/ 文件夹中。我什至对我的 Github 存储库进行了三次检查,以确保它们每个都有自己的部署密钥(来自 cpanel 的公共 SSH 密钥)。
任何指导将不胜感激!
非常感谢!!担
解决方案
根据 VonC 回答的评论链,在 cPanel 中创建 Git 存储库时,您不能使用 ssh 配置中的别名。这让生活变得艰难。
但由于某种原因,您可以通过 API 运行等效命令。因此,请改为进行 API 调用。我们想要的 API 端点是/VersionControl/create
,记录在api.docs.cpanel.net/openapi/cpanel/operation/VersionControl::create中。
进行 API 调用的最快方法是将如下所示的 URL 直接插入浏览器。
将 cpsess########## 替换为您在登录 cPanel 界面时分配的任何键。
然后你会有一个看起来像这样的 ssh 配置:
Host github_alias
Hostname github.com
User git
IdentityFile ~/.ssh/github_key1
Port 22
Host github_alias2
Hostname github.com
User git
IdentityFile ~/.ssh/github_key2
Port 22
推荐阅读
- survey - 如何在 SurveyMonkey 中添加单选题?
- autodesk-forge - 将模型上传到 BIM360 Design,而不是 BIM360 Docs
- c++ - GRPC C++ 非阻塞服务器
- ios - swift isUserInteractionEnabled = false 在 UITapGestureRecognizer 内不起作用
- snowflake-cloud-data-platform - 确定聚类关键雪花
- python - 为什么在访问 tbody 标签内的 tr 标签内容时索引会关闭?
- google-apps-script - Google Apps 脚本,与 .map() 方法连接
- python - 打印顺时针排列的数字金字塔
- vba - 如何使代码忽略microsoft word表中的垂直合并列
- heroku - 用于创建用户的 Django djoser 401/400