Gitlab与非标准SSH端口(在VM上具有Iptable转发) [英] Gitlab with non-standard SSH port (on VM with Iptable forwarding)

查看:290
本文介绍了Gitlab与非标准SSH端口(在VM上具有Iptable转发)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 gitlab 是在主机服务器上的虚拟机上。我使用非标准SSH端口(即 766 )访问VM,iptable规则从主机:766 vm:22

My gitlab is on a virtual machine on a host server. I reach the VM with a non-standard SSH port (i.e. 766) which an iptable rule then forward from host:766 to vm:22.

所以当我创建一个新的repo,错误的URL(因为它不使用 766 端口。例如,Web界面给我这个:

So when I create a new repo, the instruction to add a remote provide a mal-formed URL (as it doesn't use the 766 port. For instance, the web interface give me this:


git remote add origin git@git.domain.com:group / project.git

git remote add origin git@git.domain.com:group/project.git

而不是在群组之前包含:766 / 的网址。

Instead of an URL containing :766/ before the group.


git remote add origin git@git.domain.com:766 / group / project.git


git remote add origin git@git.domain.com:766/group/project.git

所以我创建一个仓库,我必须手动修改,我的合作者也一样
如何修复如果在config / gitlab.yml中正确配置ssh_port,那么

So it time I create a repo, I have to do the modification manually, same for my collaborator. How can I fix that ?

推荐答案

,网页将显示正确的repo url。 / p>

if you configure the ssh_port correctly in config/gitlab.yml, the webpages will show the correct repo url.

## GitLab Shell settings
gitlab_shell:
  ...
  # If you use non-standard ssh port you need to specify it
  ssh_port: 766


正确的网址是:
ssh://git@git.domain.com:766 / group / project.git

ps. the correct url is: ssh://git@git.domain.com:766/group/project.git

编辑:after您需要清除缓存等的更改:

edit: after the change you need to clear caches, etc:

bundle exec rake cache:clear assets:clean assets:precompile RAILS_ENV=production

这篇关于Gitlab与非标准SSH端口(在VM上具有Iptable转发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆