Allow ports to import repository


I’m trying to import a repository from other git server that it’s the same network, this server uses port 83. I receive an error saying that the port is not allowed.

I edited the following file /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/url_blocker.rb as following:

def validate!(
ports: [22,80,81,82,83,443],
schemes: ,

I reconfigured and restarted, but it does not work.
I attach the versions information.

System information
Proxy: HTTP_PROXY: proxy:3128
FTP_PROXY: proxy:3128
http_proxy: http://proxy:3128
HTTPS_PROXY: proxy:3128
ftp_proxy: proxy:3128
https_proxy: http://proxy:3128
Current User: git
Using RVM: no
Ruby Version: 2.6.6p146
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.9
Git Version: 2.27.0
Sidekiq Version:5.2.7
Go Version: unknown

GitLab information
Version: 13.1.4-ee
Revision: 66acdb3d3e9
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
URL: http://server_url
HTTP Clone URL: http://server_url/some-group/some-project.git
SSH Clone URL: git@server_url:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version: 13.3.0
Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories
    GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
    Git: /opt/gitlab/embedded/bin/git

I hope someone can help me I have to import several repos :S

Thanks for taking the time to be thorough in your request, it really helps! :blush:

The reason the Ruby code change is ineffective is because it appears to be altering the method’s default arguments, which is overridable by its callers.

Imports currently block all ports other than 80 (HTTP) and 443 (HTTPS). You can add your trusted custom port number to the constant list consulted within /opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:

- VALID_IMPORT_PORTS = [80, 443].freeze
+ VALID_IMPORT_PORTS = [80, 83, 443].freeze

Please note that this comes with the risk of allowing all other forms of URLs run over port 83. I’d recommend reverting the change once your import is completed (if this is a one-time event).

Please also log a feature proposal if you feel it there is merit in allowing simpler, configurable port customizations for your use-case.

It works! Thanks a lot for your help, I will remove the ports as soon as I migrate all the repos.