0

我有一个 git push 命令,但它似乎翻译错了。我已经在 gitlab 设置-> ci/cd-> 变量中设置了用户名和 api 密钥,但是在运行器上它显示它完全不同并且失败

$ git config user.name "$GITLAB_USER_NAME"
$ git config user.email "$GITLAB_USER_EMAIL"
$ git add .
$ git diff-index --quiet HEAD || git commit -m "[skip ci] migrations"
$ git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL}" "HEAD:qa" -o ci.skip
fatal: unable to access 'https://First Last:@https://gitlab-ci-token:[MASKED]@gitlab.com/xxx/yyy.git/': Could not resolve host: https

在我的 gitlab yml 我有

build:
  stage: build
  before_script:
    - git config user.name "$GITLAB_USER_NAME"
    - git config user.email "$GITLAB_USER_EMAIL"
  script:
    - git add .
    - git diff-index --quiet HEAD || git commit -m "[skip ci] migrations"
    - git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL}" "HEAD:qa" -o ci.skip
  dependencies:
    - migrations
  only:
    - qa

首先是 URL,它添加了两次 https,其次它没有GITLAB_USER_NAME正确翻译

4

0 回答 0