如何从 ssh git 存储库 url 导入 gitlab 中的存储库?
Posted
技术标签:
【中文标题】如何从 ssh git 存储库 url 导入 gitlab 中的存储库?【英文标题】:How import repository in gitlab from a ssh git repository url? 【发布时间】:2019-09-30 20:50:37 【问题描述】:我想用ssh://在gitlab中导入一个项目
我在同一个网络上:
安装在 raspebrry 上的 gitlab synology 上的 git 服务器我的 git 服务器只能通过 ssh://*****@mysynology:/the/repository/path/myproject.git 访问
我尝试了没有密码的 ssh 密钥身份验证,但我不知道 gitlab 用于执行 git clone 的用户...
我在 gitlab 中有这条消息:
Error importing repository ssh://*****@mysynology/the/repository/path/myproject.git into root/myproject - Cloning into bare repository '[REPOS PATH]/root/myproject.git'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
【问题讨论】:
【参考方案1】:首先尝试通过 SSH 连接到 *****@mysynology
,并确保 /the/repository/path/myproject.git
可以访问。
然后使用 SSH URL 在您的本地 PC 上克隆该 repo。
最后,回到你的 GitLab。
我不知道 gitlab 用来做 git clone 的用户...
不需要:创建一个新的空 GitLab 存储库(以接收您的推送)。
该新存储库的 GItLab 页面将显示您应该包含在 SSH URL 中的 SSH 用户(通常是“git
”)
【讨论】:
好的,谢谢,但我想将我的存储库保留在我的 Synology 上,并在我的 Synology 上做所有的推/拉,这可能吗? @jeremy.romano 是的,我的回答是关于你的 GitLab,你的 Synology 上的那个。 抱歉,我的 gitlab 在树莓派上,只有我的 git 服务器在我的 synology 上 @jeremy.romano OK 那么:你在 raspberry 上的 GitLab:只要你在上面注册了一个有效的 SSH 密钥,你就可以配置你的本地 SSH 在推送到你的 GitLab 时使用该密钥(使用一个 .ssh/config 文件,如***.com/a/23751734/6309)以上是关于如何从 ssh git 存储库 url 导入 gitlab 中的存储库?的主要内容,如果未能解决你的问题,请参考以下文章