Reference is not a tree

have set up a runner to try and sync changes from app building on mac to gitlab.
for some reason adding repositary in xcode just hated my log in, anyway I can get the running up now and it seems to run but hits an odd error that I cant seem to get past yet

gitlab-ci-multi-runner 1.3.3 (6220bd5)
Using Shell executor...
Running on jfb63-1007t-w01...
Fetching changes...
Checking out 416b9bba as master...
fatal: reference is not a tree: 416b9bbaae8d1dd071ad725eccfe2b3f5a799002

ERROR: Build failed: exit status 1

Do you use GitLab over SSH for your normal work? If you use SSH for your normal work and you use a custom Nginx (or other webserver, such as Apache) configuration instead of the built-in Omnibus one, you might be hitting this issue because the CI worker connects over HTTP(S):


Looking through the issue tracker, this actually seems to be a very common issue, which almost everyone fixes by fixing their webserver configs.

it connects via

http://gitlab-ci-token:xxxxxx@gitlab.adamprocter.co.uk:8081/adamprocter/hello-world.git/

I tried adding

gitlab_git_http_server[‘listen_network’] = “tcp”
gitlab_git_http_server[‘listen_addr’] = “localhost:8081”

&

upstream gitlab {
server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
}

upstream gitlab-git-http-server {
server localhost:8081;
}

same problem not sure if would be easier but happy to get SSL for https ?

Your problem is that the URLs being generated for your git repositories contain the port number 8081 in them, but you need to access GitLab using the standard port 80.

It’s most likely that your GitLab is simply misconfigured. Can you post your complete GitLab and Nginx config files (without passwords or keys)?

Sure

Thanks I am still stuck on this : here is my nginx

upstream gitlab {
    server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
 }

upstream gitlab-git-http-server {
server localhost:8081;
}

server {
    listen 217.147.85.86:80;
    listen [::]:8081 default_server ipv6only=on;

location /.well-known/acme-challenge/ {
proxy_pass http://gitlab.adamprocter.co.uk:8081;
}


    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name gitlab.adamprocter.co.uk;

    location / {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       proxy_pass http://gitlab;
    }
}

and here is my gitlab.rb

nginx['enable'] = false
## gitlab_git_http_server['listen_network'] = "tcp"
## gitlab_git_http_server['listen_addr'] = "localhost:8081"

external_url 'http://gitlab.adamprocter.co.uk:8081'
web_server['external_users'] = ['nginx']
gitlab_rails['trusted_proxies'] = [ '192.168.1.0/24', '192.168.2.1', '2001:0db8::/32' ]

I also tried to add SSL via letsencrypt which I thought might help
but the 8081 issue also messes the set up for that too however at the
moment I just want to be able to connect via a runner so I can hopefully
start to upload my code

Your gitlab.rb needs only minor corrections, but your Nginx config file was extremely out of date. Newer versions of GItLab (8.2+) have a totally different method of handling incoming requests. Here is what your files should look like (including config for LetsEncrypt):

gitlab.rb

nginx['enable'] = false
# You don't need any special configuration of `gitlab_git_http_server`

external_url 'https://gitlab.adamprocter.co.uk' # No port number here, but with HTTPS
web_server['external_users'] = ['nginx']
gitlab_rails['trusted_proxies'] = [ '192.168.1.0/24', '192.168.2.1', '2001:0db8::/32' ]

nginx-site-for-gitlab.conf

(Or whatever your name for it is)

upstream gitlab-workhorse {
  server unix:/var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0;
}

# Non-secure redirects to secure (except for LetsEncrypt)
server {
  listen 217.147.85.86:80;
  listen [::]:80 ipv6only=on;
  server_name gitlab.adamprocter.co.uk;
  server_tokens off; ## Don't show the nginx version number, a security best practice

  # Handle LetsEncrypt validation
  location ~ /\.well-known {
    root /usr/share/nginx/html;
  }

  # Redirect all other requests to secure
  location / {
    return 301 https://$http_host$request_uri;
  }
}

# Secure does all the real work
server {
  listen 217.147.85.86:443 ssl;
  listen [::]:443 ssl  ipv6only=on;
  server_name gitlab.adamprocter.co.uk;
  server_tokens off;

  ## Strong SSL Security
  ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
  ssl on;
  ssl_certificate     /etc/letsencrypt/live/gitlab.adamprocter.co.uk/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/gitlab.adamprocter.co.uk/privkey.pem;

  # GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
  ssl_ciphers  'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
  ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_session_cache  shared:SSL:10m;
  ssl_session_timeout  5m;

  ## Individual nginx logs for this GitLab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    client_max_body_size 0;
    gzip off;

    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    proxy_http_version 1.1;

    proxy_set_header    Host                gitlab.adamprocter.co.uk;
    proxy_set_header    X-Forwarded-Host    "";
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-Ssl     on;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_pass http://gitlab-workhorse;
  }

  error_page 404 /404.html;
  error_page 422 /422.html;
  error_page 500 /500.html;
  error_page 502 /502.html;
  location ~ ^/(404|422|500|502)\.html$ {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    internal;
  }

  # Also include LetsEncrypt on secure
  location ~ /\.well-known {
    root /usr/share/nginx/html;
  }
}

Try this and see if it helps.

2 Likes

Great thanks - need try and get my letsencrypt working as at the moment I seem to have an issues with virtualenv command not found

Ok have got a it further run this - How to Fix virtualenv: command not found on CentOS 6?

and now lets encypt is a little stuck to make my certificates at the moment with a 404 for the location

http://gitlab.adamprocter.co.uk/.well-known/acme-challenge/vInqfn58iFGWN2rI4lYcKqSplrsyl8FATxxqsFa6E9o:

Thanks things are almost working now :smiley: I had to bump ver a couple more hurdles with my set up. This helped as well - https://botleg.com/stories/https-with-lets-encrypt-and-nginx/

The server is now all set up with https and the runner connects fine just cant find xcode project for some reason

Checking out 0482f88e as master...
$ xcodebuild clean -project myproject.xcodeproj -scheme irishdancer
2016-08-24 23:18:46.259 xcodebuild[2294:170922] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs
xcodebuild: error: 'myproject.xcodeproj' does not exist.
ERROR: Build failed: exit status 1

I see that you started a new post for the Xcode error. I’m sorry I can’t help with that - I have enough Xcode problems of my own.

I suggest that you mark my post with the config files as an answer so that others with the same question will be able to find it in the future. Thanks!

1 Like

@kohenkatz done. Thank you so much your help has made a huge difference. Hopefully I can work out the Xcode upload with runner issue now. However I suspect if I did a standard terminal interaction all would be working so than you.