gpt4 book ai didi

ssh - GitLab 无法推送到远程 - 缺少 SSH key - .ssh/config 中的通用 SSH 条目

转载 作者:行者123 更新时间:2023-12-02 14:02:58 28 4
gpt4 key购买 nike

在创建一个新的仓库(本地 + 远程)之后,我正在尝试推送提交。但是我遇到了 SSH key 的问题

在我的 ~/.ssh/config 中,我有一个 gitlab 条目定义为

Host MyRepoJD
HostName gitlab.myrepo.ninja
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab_myRepo/johnDoe

当我尝试从我的 ruby​​ 脚本推送到 gitlab 中新创建的仓库时(gran_torino_sa/mar_arch 组:gran_torino_sa 项目:mar_arch)它失败了,因为这个新创建的仓库没有条目......
ssh: Could not resolve hostname    
gitlab.myrepo.ninja:gran_torino_sa/mar_arch.git: nodename nor servname provided, or not known

有没有办法为创建的任何组/项目只定义一个条目,或者是否必须为每个新组/项目添加一个条目?

最佳答案

myrepoafter 再次调试......在这篇文章中找到了解决方案

“为给定域的 git push 指定 SSH key ”
Specify an SSH key for git push for a given domain

Host gitlab_as_johndoe
HostName gitlab.myrepo.ninja
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab_myrepo/johndoe
IdentitiesOnly yes

并使用
  git remote add origin git@gitlab_as_johndoe:gran_torino_sa/mar_arch.git"

做的伎俩...

关于ssh - GitLab 无法推送到远程 - 缺少 SSH key - .ssh/config 中的通用 SSH 条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30278489/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com