在gitlab中使用gitlab-sshd替换ssh服务

参考:https://docs.gitlab.com/ee/administration/operations/gitlab_sshd.html

说明

gitlab-sshd 是 OpenSSH 的轻量级替代品,用于提供 SSH 操作。虽然 OpenSSH 使用受限的 shell 方法,但 gitlab-sshd 的行为更像是一个现代的多线程服务器应用程序,响应传入的请求。主要区别在于 OpenSSH 使用 SSH 作为传输协议,而 gitlab-sshd 使用远程过程调用 (RPC)。

一句话总结:使用gitlab-sshd可以替换虚拟机本机的ssh功能,从而实现不依赖虚拟机的sshd服务。

启用gitlab-sshd

  • 编辑gitlab.rb配置文件

    启用gitlab_sshd服务

    gitlab_sshd['enable'] = true
    gitlab_sshd['listen_address'] = '[::]:2222'

    git url地址指向2222端口

    gitlab_rails['gitlab_shell_ssh_port'] = 2222

  • 试配置生效

    gitlab-ctl reconfigure

测试

需要清理下本地的know_hosts文件,然后测试。

复制代码
git clone ssh://git@kube.bdeet.top:2222/mr/123.git
相关推荐
在路上走着走着7 小时前
openclaw v2026.4.5 版本 提示 pairing required 解决方案
gitlab
Gazer_S4 天前
【GitLab npm Registry 非标准端口安装问题解决方案】
前端·npm·gitlab
-KamMinG4 天前
Gitlab版本升级方案-13.x到17.x
gitlab
菜鸡00016 天前
把一个项目传到 GitLab 的某个群组
大数据·elasticsearch·gitlab
AlbertS7 天前
记一次推送lfs失败不能迁移git仓库到新的gitlab的问题
git·ai·gitlab·lfs·rejected
日更嵌入式的打工仔7 天前
Windows 下 GitLab 完整使用指南
windows·gitlab
会飞的大可7 天前
Jenkins vs GitLab CI/CD:2026 企业级 CI/CD 工具深度选型评测
ci/cd·gitlab·jenkins
庭風8 天前
让 AI 从需求直接走到 MR:我开源了一个面向 GitLab 的工作流 MCP
gitlab
Sakuyu434688 天前
Git-GitLab-JenKins
git·gitlab·jenkins
Aaron_dw8 天前
基于 Jenkins + GitLab + 自动化测试的 CI/CD 自动化系统方案(IaC + 弹性构建节点)
ci/cd·gitlab·jenkins