semantic-release: git verifyAuth failed on public Github repository

Current behavior

During the CI run I receive a failure of the verifyAuth function (lib/git.js). The git push in dry-run mode to my public Github repository does not work. The call does not use the GH_TOKEN environemt variable to authenticate. The failure seems to be not very crtitcal because the following steps are running without errors. The step “Verify GitHub authentication” works correct so there is no real problem.

Expected behavior

  1. No simple verification test of the git repository because the connectivity to Github will be checked later.

OR

  1. The verification test should use the GH_TOKEN environment variable to authenticate.

Environment

...
  py36: commands succeeded
  flake8: commands succeeded
  congratulations :)

travis_time:end:19ce6194:start=1520925358526575323,finish=1520925376365937399,duration=17839362076

The command "tox" exited with 0.
travis_fold:start:after_success.1
travis_time:start:079149b4
$ nvm install lts/*
Downloading and installing node v8.10.0...
Downloading https://nodejs.org/dist/v8.10.0/node-v8.10.0-linux-x64.tar.xz...
Computing checksum with sha256sum
Checksums matched!
Now using node v8.10.0 (npm v5.6.0)

travis_time:end:079149b4:start=1520925376373571227,finish=1520925379187824204,duration=2814252977
travis_fold:end:after_success.1
travis_fold:start:after_success.2
travis_time:start:02d84422
$ npx travis-deploy-once "npx semantic-release --debug"
npx: installed 246 in 8.829s
[Travis Deploy Once]: There is only one job for this build.
npx: installed 387 in 13.296s
[Semantic release]: Running semantic-release version 15.0.3
2018-03-13T07:16:43.735Z semantic-release:git Error: Command failed: git push --dry-run https://github.com/escalate/loxone-ha-bridge-importer.git HEAD:master
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/escalate/loxone-ha-bridge-importer.git/'


    at makeError (/home/travis/.npm/_npx/2975/lib/node_modules/semantic-release/node_modules/execa/index.js:169:9)
    at Promise.all.then.arr (/home/travis/.npm/_npx/2975/lib/node_modules/semantic-release/node_modules/execa/index.js:274:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
2018-03-13T07:16:43.741Z semantic-release:config options values: { branch: 'master',
  repositoryUrl: 'https://[secure]@github.com/escalate/loxone-ha-bridge-importer.git',
  tagFormat: 'v${version}',
  verifyConditions: [ '@semantic-release/github' ],
  analyzeCommits: [ '@semantic-release/commit-analyzer' ],
  verifyRelease: [],
  generateNotes: [ '@semantic-release/release-notes-generator' ],
  prepare: [],
  publish: [ '@semantic-release/github' ],
  success: [ '@semantic-release/github' ],
  fail: [ '@semantic-release/github' ],
  _: [],
  debug: true,
  '$0': '../../../.npm/_npx/2975/bin/semantic-release' }
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
[Semantic release]: Load plugin analyzeCommits from @semantic-release/commit-analyzer
[Semantic release]: Load plugin generateNotes from @semantic-release/release-notes-generator
[Semantic release]: Load plugin publish from @semantic-release/github
[Semantic release]: Load plugin success from @semantic-release/github
[Semantic release]: Load plugin fail from @semantic-release/github
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify GitHub authentication
2018-03-13T07:16:44.673Z semantic-release:get-last-release found tags: []
[Semantic release]: No git tag version found
[Semantic release]: No previous release found, retrieving all commits
[Semantic release]: Found 23 commits since last release
...

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

After further investigations, Travis never prompt the user because it sets GIT_ASKPASS=echo. Semaphore doesn’t set this variable and prompt for the user/password.

On Semaphore, if GIT_TERMINAL_PROMPT is set to 0 or if GIT_ASKPASS is set to echo there is no prompt and the git command errors out as expected.

It seems GIT_TERMINAL_PROMPT is a good solution but it was added in Git 2.3.0. The current version of Git is 2.16.1 but some CIs (especially CircleCI) use really old version of git.

So in order to be sure it won’t happen on any CI I would propose to do the following, only when semantic-release runs on a CI:

  • Set GIT_TERMINAL_PROMPT to 0
  • Set GIT_ASKPASS to echo
  • Set a timeout when calling execa