使用 GitLab CI.yml 登录 Heroku



我一直在尝试将我的 GitLab 应用程序部署到 Heroku,但不幸的是,当我尝试运行heroku login -i时,我不断收到此错误

Run `heroku login` to update your credentials, then retry the git command.

我已经从网络上查看了解决方案,但似乎没有帮助。我做错了吗?

这是我的YML文件

before_script:
  - echo "Running job..."
build_job_1:
  script:
    - heroku login -i
    - blank
    - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # Account token
    - git remote add heroku https://heroku:XXXXX@git.heroku.com/redditchatbot.git 
    - git push heroku HEAD:master

感谢您的帮助!

编辑:我在下面包含了完整的日志

Running with gitlab-runner 11.9.0-rc2 (227934c0)
  on docker-auto-scale 0277ea0f
Using Docker executor with image ruby:2.5 ...
Pulling docker image ruby:2.5 ...
Using docker image sha256:e86557c9a8ab97ec7e9ba705f3e3411428b50d19d38643a0f52cb49faf735d3d for ruby:2.5 ...
Running on runner-0277ea0f-project-11711672-concurrent-0 via runner-0277ea0f-srm-1554580242-7d379f26...
Initialized empty Git repository in /builds/WillWam/reddump/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/WillWam/reddump
 * [new branch]      master     -> origin/master
Checking out f2d6762d as master...
Skipping Git submodules setup
$ echo "Running job..."
Running job...
$ git remote add heroku https://heroku:XXXXX@git.heroku.com/redditchatbot.git
$ git push heroku HEAD:master
remote: !   WARNING:
remote: !   Do not authenticate with username and password using git.
remote: !   Run `heroku login` to update your credentials, then retry the git command.
remote: !   See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://heroku:XXXX@git.heroku.com/redditchatbot.git/'
ERROR: Job failed: exit code 1

不要使用 git 使用用户名和密码进行身份验证

这意味着:不要在你的URL中使用heroku:

XXXXX:heroku登录应该缓存你的凭据,这意味着你不需要URL中的凭据。

如果问题仍然存在,请检查"'git push heroku master'仍在要求进行身份验证"的解决方案之一

最新更新