Skip to content

Locally running gitlab-runner does not have permission to read from git repository

When locally executing gitlab-runner jobs I get fatal: Could not read from remote repository. error messages.

Steps to reproduce

Executing the following:

$ gitlab-runner exec docker job-name

Expected result

Should execute gitlab-runner without errors.

Actual result

Get the following error message:

$ gitlab-runner exec docker job-name
Runtime platform                                    arch=amd64 os=darwin pid=73498 revision=de7731dd version=12.1.0
Running with gitlab-runner 12.1.0 (de7731dd)
Using Docker executor with image XXXXXXXXXXXXXXXXXX:latest ...
Authenticating with credentials from /Users/ricardo/.docker/config.json
Pulling docker image XXXXXXXXXXXXXXXXXXXX:latest ...
Using docker image sha256:4a0a14fa4b7f846387168f09f0385bba4d2ae50f4f1870a347275c6f7ed4e420 for XXXXXXXXXXXXXXlatest ...
Running on runner--project-0-concurrent-0 via Ricardos-MacBook-Pro.local...
Fetching changes...
Initialized empty Git repository in /builds/project-0/.git/
Created fresh repository.
fatal: '/Users/ricardo/Projects/XXXXXXXX' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR: Job failed: exit code 1
FATAL: exit code 1             

Additional information

gitlab-runner version is:

$ gitlab-runner --version
Version:      12.1.0
Git revision: de7731dd
Git branch:   12-1-stable
GO version:   go1.12.7
Built:        2019-07-23T14:08:50+01:00
OS/Arch:      darwin/amd64
XXXXXX (XXXXX) 

$ docker version
Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:39 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.0
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       aeac9490dc
  Built:            Wed Jul 17 18:22:15 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Note: Confidential information masked with Xs.

Edited by Ricardo Gladwell