Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #3425

Closed
Open
Created Mar 27, 2013 by Administrator@rootOwner

Setting relative url root will break cloning/pushing to git

Created by: turbulenceX

I did a fresh install of Gitlab 5.0 on Ubuntu 12.04. I tested the install with and without using the relative url root setting.

Without setting relative url root, everything seems to work.

With setting relative url root, the push and clone breaks. The following config files I have changed:

unicorn.rb ENV['RAILS_RELATIVE_URL_ROOT'] = "/myrepos"

gitlab.yml

  ## GitLab settings
  gitlab:
    ## Web server settings
    host: mydomain.com
    port: 80
    https: false
    # Uncomment and customize to run in non-root path
    # Note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed
    relative_url_root: /myrepos

    # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
    # user: git

    ## Email settings
    # Email address used in the "From" field in mails sent by GitLab
    email_from: gitlab@localhost

    # Email address of your support contact (default: same as email_from)
    support_email: support@localhost

    ## Project settings
    default_projects_limit: 10
    # signup_enabled: true          # default: false - Account passwords are not sent via the email if signup is enabled.
    # username_changing_enabled: false # default: true - User can change her username/namespace

...

/etc/nginx/sites-available/gitlab

# GITLAB
# Maintainer: @randx
# App Version: 5.0

upstream gitlab {
  server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}

server {
  listen mydomain:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name mydomain.com;     # e.g., server_name source.example.com;
  root /home/git/gitlab/public;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location /myrepos {
    alias /home/git/gitlab/public;
    # serve static files from defined root folder;.
    # @gitlab is a named location for the upstream fallback, see below
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  # if a file, which is not found in the root folder is requested,
  # then the proxy pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;

    proxy_pass http://gitlab;
  }
}

CREATING TEST REPOSITORY This was the instructions given on by gitlab after creating test.git

mkdir test
cd test
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin [email protected]:root/test.git
git push -u origin master

OUTPUT

$git clone http://mydomain.com/myrepos/root/test.git

fatal: http://mydomain.com/myrepos/root/test.git/info/refs not found: did you run git update-server-info on the server?
$git remote add origin [email protected]:root/test.git
$git push -u origin master

fatal: The remote end hung up unexpectedly

gitlab_error.log

2013/03/27 12:15:16 [error] 11016#0: *5 open() "/home/git/gitlab/public/api/v3/internal/allowed" failed (2: No such file or directory), client: 127.0.0.1, server: mydomain.com, request: "GET //api/v3/internal/allowed?key_id=1&action=git-receive-pack&ref=_any&project=myrepos/root/test HTTP/1.1", host: "mydomain.com"

Other Notes

  • git definitely detects my public key:

ssh -vT [email protected]

debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ban/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
...
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to GitLab, Anonymous!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3432, received 2688 bytes, in 1.9 seconds
Bytes per second: sent 1848.1, received 1447.5
debug1: Exit status 0
  • git repository folder and files are owned by git, so it shouldn't be a permissions problem at all.
  • I have tried using the solution *:80 in the nginx config file, but this did not solve anything (see #3384 (closed))
  • I can successfully view my newly created test project on gitlab's web ui at mydomain.com/myrepos/root/test. I have only tested the create new project on the web ui, and nothing else, but for the most part the web ui seems to run fine.
Assignee
Assign to
Time tracking