gitlab change hostname to ip/gitlab - gitlab

I installed Gitlab from source using this manual https://docs.gitlab.com/ce/install/installation.html
Now GitLab work on adress http://gitlab.example. I want to change hostname to 192.168.1.1/gitlab.
I changed in file /home/git/gitlab/config/gitlab.yml
host: gitlab.example to host: 192.168.1.1/gitlab
in file /home/git/gitlab-shell/config.yml
gitlab_url: http://gitlab.example
to gitlab_url: http://192.168.1.1/gitlab
I use Apache2.4 and configure with this example
https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache24.conf
I changed ServerName gitlab.example to gitlab or 192.168.1.1/gitlab
But it doesn't work.
What i forget? How can I change URL of gitlab.
Can I use gitlab.example and 192.168.1.1/gitlab at the same time?
Thank for your answers.

The servername cannot contain a /, so 192.168.1.1/gitlab will not work.
You could try simply 192.168.1.1
But if you do not know how to configure apache, you might want to try the ombnibus installation instead...

Related

Why some gitlab project clone with SSH do not have SSH schema?

when I watch a tutorial:
when clone a project with SSH, it shows git#xxx like below:
but when I use my Gitlab in practice:
there have schema ssh://, what's the difference?
ssh://git#gitlab.demo.com:222/xxx
That depend on how the custom SSH URL was set for your GitLab instance:
gitlab-ctl show-config | gitlab_ssh_host
The default one uses the default SSH URL scheme, using '/' only.
But you can set it to a SCP-style URL, without ssh://, and using a ':' between domain and URL path.
To change it:
Edit /etc/gitlab/gitlab.rb
Search for gitlab_rails['gitlab_ssh_host'] = 'your.hostname.here'
Update the hostname value and run a gitlab-ctl reconfigure afterwards.

Change SSH repo url in GitLab

I have gitlab on my server. URL, for example: https://git.site.com
On project page I have similar URL for my repo:
How I can change path only for ssh repo path? I need IP address of my server, not URL
Change this in the /etc/gitlab/gitlab.rb
gitlab_rails['gitlab_ssh_host'] = 'gitssh.example.com'
and then run gitlab-ctl reconfigure
You should take a look at external_url configuration field: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
If you're using Omnibus, you can also custom the SSH host: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template#L39

Trying to install GitLab on Apache on CentOS 7

I'm trying to install GitLab, but I want to install it on an Apache web server on my VPS.
I know that GitLab was built for nginx, but I honestly don't want to use it. I was wondering how I would be able to have a setup so that
mysite.com would retrieve the files (like index.html, folders with more files in them, etc.) in /var/www/html
lab.mysite.com would retrieve GitLab.
I've heard you're supposed to use a virtual host, but remember, I'm still an amateur at best with this kind of stuff, so if anyone here is kind enough to make a short step-by-step guide to do this, I'd appreciate this.
Note: Before I've been using this guide to install GitLab, however this is for Nginx, so I was wondering if I was to use this guide but then add onto it, or if I'm going about this all wrong.
By default GitLab will install nginx but usually won't add nginx to your system's service manager (service or systemctl). This makes it confusing when trying to enable Apache (Apache won't start due to default port 80 in use by nginx).
Assuming you've installed Gitlab according to the default install instructions, the Nginx service will now be managed by the gitlab-ctl service manager (which is installed when installed Gitlab).
To stop Nginx, run the following from a command line as root:
gitlab-ctl stop nginx
Now that port 80 is free, you can start Apache (don't forget to install Apache if it's not already / Instructions are for RHEL systems - modify accordingly for Ubuntu etc). Assumes you are root user:
yum install -y httpd;
systemctl start httpd;
systemctl enable httpd;
Let's edit the Gitlab config file to disable nginx and tell gitlab to use apache:
vi /etc/gitlab/gitlab.rb
Add either your domain or IP to the following:
external_url 'http://git.yourdomain.com/'
Find:
# web_server['external_users'] = []
Change to (don't forget to remove the leading '#'):
web_server['external_users'] = ['apache']
Find:
# nginx['enable'] = true
Change to:
nginx['enable'] = false
And finally we have to run a "recompile" with:
gitlab-ctl reconfigure
gitlab-ctl restart
Now the Apache config. When we installed Gitlab, it added a user group called gitlab-www. We need to allow the apache user access to that group. The following assumes you've installed apache and the user apache (48) exists:
To check which group gitlab installed itself under, you can run:
getent group
Now lets modify apache's user and add it to the gitlab-www group:
usermod apache --append --groups gitlab-www
Now we need an Apache Virtual Host to point to the gitlab install.
Add a virtual host to Apache's conf.d directory (this will create a new file):
vi /etc/httpd/conf.d/gitlab.conf
Add the following (tweak according to your needs):
<VirtualHost *:80>
ServerName git.yourdomain.com
ServerSignature Off
ProxyPreserveHost On
<Location />
Order deny,allow
Allow from all
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://git.yourdomain.com/
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
# needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined env=!dontlog
</VirtualHost>
... And now restart Apache:
systemctl start httpd
You may run into issues with things like selinux - You can set things to permissive for debugging purposes.
setenforce 0
I hope this helps someone!

Change SSH host for cloning

Is there any way to change default ssh host for gitlab (displayed at top of repository view in web interface)? I mean only for SSH in clone urls.
For example I have my gitlab installation on git.example.com, but example.com also points to the same machine (different site). Can I change ssh clone urls from:
git clone git#git.example.com:user/repository
to:
git clone git#example.com:user/repositiory
but for http and https leave it with git.example.com?
Yes,
If you are using the omnibus package you can edit /etc/gitlab/gitlab.rb and add gitlab_rails['gitlab_ssh_host'] = 'example.host.com'
There is the equivalent option somewhere in gitlab.yml : ssh_host: example.host.com
Yes.
If your subdomain behaves the same way your actual domain does, it should not be a problem. If the subdomain points to the same IP, git or ssh for that matter should not bother.

Gitlab defaults to localhost

I've successfully installed Gitlab on a cloud server but every time I try to create a new project it defaults to localhost so if I try to push to it it attempts to push to the the local machine instead of the remote one.
Is there any way to set an IP address for the destination push?
Any help appreciated...
There's a part in your config/gitlab.yml that says something along the line of replace "localhost" with.... And the restart your app.
If that didn't help, post your config.

Resources