gitlab: git ls-remote --heads https://gitlab-ci-token:... request fails

I’ve followed the tutorial for Gitlab over at https://docs.gitlab.com/ee/ci/examples/semantic-release.html. When running our pipeline, we’re receiving an authentication error. I’ve defined a GITLAB_TOKEN variable with the value set to my Project Access Token value. I’ve defined a NPM_TOKEN variable with the value set to my Personal Access Token value. I’ve defined a GITLAB_URL variable with the value set to ‘https://gitlab.atsgroep.be/’. I’ve defined a GITLAB_PREFIX variable with the value set to ‘/api/v4’.

Gitlab version: 13.3.6-ee (d7bc82f4b06) Gitlab shell version: 13.6.0

semantic-release --debug [7:36:14 AM] [semantic-release] › ℹ Running semantic-release version 17.3.0 2020-12-11T07:36:14.878Z semantic-release:config load config from: /builds/DEV/vanguard/.releaserc.json 2020-12-11T07:36:14.893Z semantic-release:config options values: { branches: [ ‘master’ ], repositoryUrl: ‘https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git’, tagFormat: ‘v${version}’, plugins: [ ‘@semantic-release/commit-analyzer’, ‘@semantic-release/release-notes-generator’, ‘@semantic-release/gitlab’, ‘@semantic-release/npm’, [ ‘@semantic-release/git’, [Object] ] ], _: [], debug: true, ‘$0’: ‘node_modules/.bin/semantic-release’ } 2020-12-11T07:36:15.386Z semantic-release:plugins options for @semantic-release/gitlab/verifyConditions: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “verifyConditions” from “@semantic-release/gitlab” 2020-12-11T07:36:15.392Z semantic-release:plugins options for @semantic-release/npm/verifyConditions: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “verifyConditions” from “@semantic-release/npm” 2020-12-11T07:36:15.393Z semantic-release:plugins options for @semantic-release/git/verifyConditions: { assets: [ ‘package.json’ ], message: ‘chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}’ } [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “verifyConditions” from “@semantic-release/git” 2020-12-11T07:36:15.394Z semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “analyzeCommits” from “@semantic-release/commit-analyzer” 2020-12-11T07:36:15.395Z semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “generateNotes” from “@semantic-release/release-notes-generator” 2020-12-11T07:36:15.396Z semantic-release:plugins options for @semantic-release/npm/prepare: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “prepare” from “@semantic-release/npm” 2020-12-11T07:36:15.397Z semantic-release:plugins options for @semantic-release/git/prepare: { assets: [ ‘package.json’ ], message: ‘chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}’ } [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “prepare” from “@semantic-release/git” 2020-12-11T07:36:15.398Z semantic-release:plugins options for @semantic-release/gitlab/publish: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “publish” from “@semantic-release/gitlab” 2020-12-11T07:36:15.399Z semantic-release:plugins options for @semantic-release/npm/publish: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “publish” from “@semantic-release/npm” 2020-12-11T07:36:15.399Z semantic-release:plugins options for @semantic-release/npm/addChannel: {} [7:36:15 AM] [semantic-release] › ✔ Loaded plugin “addChannel” from “@semantic-release/npm” 2020-12-11T07:36:15.426Z semantic-release:get-git-auth-url Verifying ssh auth by attempting to push to https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git 2020-12-11T07:36:15.655Z semantic-release:git Error: Command failed with exit code 128: git push --dry-run --no-verify https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git HEAD:master remote: You are not allowed to upload code. fatal: unable to access ‘https://gitlab.atsgroep.be/DEV/vanguard.git/’: The requested URL returned error: 403 at makeError (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/lib/error.js:59:11) at handlePromise (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/index.js:114:26) at process._tickCallback (internal/process/next_tick.js:68:7) 2020-12-11T07:36:15.655Z semantic-release:get-git-auth-url SSH key auth failed, falling back to https. [7:36:15 AM] [semantic-release] › ✖ An error occurred while running semantic-release: { Error: Command failed with exit code 128: git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git remote: HTTP Basic: Access denied fatal: Authentication failed for ‘https://gitlab.atsgroep.be/DEV/vanguard.git/’ at makeError (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/lib/error.js:59:11) at handlePromise (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/index.js:114:26) at process._tickCallback (internal/process/next_tick.js:68:7) shortMessage: ‘Command failed with exit code 128: git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git’, command: ‘git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git’, exitCode: 128, signal: undefined, signalDescription: undefined, stdout: ‘’, stderr: ‘remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.atsgroep.be/DEV/vanguard.git/\’‘, failed: true, timedOut: [secure], isCanceled: [secure], killed: [secure] } { Error: Command failed with exit code 128: git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git remote: HTTP Basic: Access denied fatal: Authentication failed for ‘https://gitlab.atsgroep.be/DEV/vanguard.git/’ at makeError (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/lib/error.js:59:11) at handlePromise (/builds/DEV/vanguard/node_modules/semantic-release/node_modules/execa/index.js:114:26) at process._tickCallback (internal/process/next_tick.js:68:7) shortMessage: ‘Command failed with exit code 128: git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git’, command: ‘git ls-remote --heads https://gitlab-ci-token:[secure]@gitlab.atsgroep.be/DEV/vanguard.git’, exitCode: 128, signal: undefined, signalDescription: undefined, stdout: ‘’, stderr: ‘remote: HTTP Basic: Access denied\nfatal: Authentication failed for 'https://gitlab.atsgroep.be/DEV/vanguard.git/\’’, failed: true, timedOut: [secure], isCanceled: [secure], killed: [secure] }npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @DEV/vanguard@0.0.1 semantic-release: semantic-release --debug npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @DEV/vanguard@0.0.1 semantic-release script.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 20 (8 by maintainers)

Most upvoted comments

I’ve encountered the same issue. Locally, I am not able to successfully run git ls-remote --heads $url unless the token is added to the URL as follows:

git ls-remote --heads https://oauth2:$GL_TOKEN@gitlab.com/path/to/repo.git

How can I fix this in the config? Without fixing this I am not able to use semantic-release with Gitlab CI successfully.

Finally got docker working again after it gave up the ghost… Seems to be an issue with certificates, indeed.

[6:39:02 AM] [semantic-release] › ✖  An error occurred while running semantic-release: { GotError: unable to verify the first certificate
    at onError (/builds/DEV/vanguard/node_modules/got/dist/source/request-as-event-emitter.js:140:29)
    at handleRequest (/builds/DEV/vanguard/node_modules/got/dist/source/request-as-event-emitter.js:173:17)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket._finishInit (_tls_wrap.js:636:8)
  name: 'RequestError',
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
  pluginName: '@semantic-release/gitlab' }
{ AggregateError: 
    GotError: unable to verify the first certificate
        at onError (/builds/DEV/vanguard/node_modules/got/dist/source/request-as-event-emitter.js:140:29)
        at handleRequest (/builds/DEV/vanguard/node_modules/got/dist/source/request-as-event-emitter.js:173:17)
    at /builds/DEV/vanguard/node_modules/semantic-release/lib/plugins/pipeline.js:54:11 name: 'AggregateError' }npm ERR! code ELIFECYCLE

Will pass it along to our network/system admin.

@aldrashan Nice, at least that error message is much more informative 👍

I’ll update it first thing tomorrow and try it out. Will report back.