英文:
git clone works locally but not from gitlab runner
问题
我今天早上在我的GitLab CI/CD上遇到了奇怪的问题。在身份验证步骤上,Git克隆操作失败了。
错误信息如下:
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.iselection.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.xxx.com/xxx/'
以下是YAML文件:
variables:
GIT_SSL_NO_VERIFY: "true"
TOKEN_NAME: certificate
TOKEN_VALUE: "xxx"
image: alpine:latest
before_script:
- apk add git curl openssl openjdk11 bash ca-certificates
- git clone https://$TOKEN_NAME:$TOKEN_VALUE@gitlab.xxx.com/xxx
因此,我正在使用在我想克隆的存储库中定义的令牌,当我在我的本地机器上运行相同的命令时,它可以顺利工作。
接下来我可以检查什么或者我可以做什么?
谢谢
编辑:其他失败的测试
- 在我的用户上创建PAT(从我的机器克隆可以正常工作,但从Gitlab CICD流水线中不行)
- 创建部署令牌(从我的机器克隆可以正常工作,但从Gitlab CICD流水线中不行)
英文:
I have a weird behavior since this morning on my gitlab CI/CD. The git clone fails on the authentication step.
The error is as follow
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.iselection.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.xxx.com/xxx/'
Here is the yaml file
variables:
GIT_SSL_NO_VERIFY: "true""
TOKEN_NAME: certificate
TOKEN_VALUE: "xxx"
image: alpine:latest
before_script:
- apk add git curl openssl openjdk11 bash ca-certificates
- git clone https://$TOKEN_NAME:$TOKEN_VALUE@gitlab.xxx.com/xxx
So I am using a token defined in the repo I want to clone and when running the same command from my local machine, it works smoothly.
What can I check next or what can I do ?
Thx
edit: other failing tests
- creation of a PAT on my user (clone works from my machine but not from the Gitlab CICD pipeline)
- creation of a deploy token (clone works from my machine but not from the Gitlab CICD pipeline)
答案1
得分: 1
我们遇到了同样的问题,似乎与最新的cURL版本(8.2.0)有关。我们将我们的libcurl
和curl
版本固定在8.0.1上,这解决了我们遇到的问题。
在我们的Alpine Docker容器中,我们更新为使用:
apk add --update --upgrade --no-cache libcurl=8.0.1-r0 curl=8.0.1-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main
英文:
We ran into this same issue and it appears to be related to the latest cURL version (8.2.0). We pinned our libcurl
and curl
versions to 8.0.1 and it fixed the issue we had.
In our Alpine docker container, we updated to use:
apk add --update --upgrade --no-cache libcurl=8.0.1-r0 curl=8.0.1-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main
答案2
得分: 1
有一个问题是在目前的alpine最新版本中出现了curl的问题。尝试使用Alpine版本3.11.13
image: alpine:3.11.13
英文:
There is an issue with curl on the latest version of alpine right now. Try using Alpine version 3.11.13
image: alpine:3.11.13
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论