Nuget Push 上的 Gitlab Runner 403 禁止错误

Gitlab Runner 403 forbidden error on Nuget Push

我正在尝试准备一个 CI 管道,它将在每次提交时将 .dll 打包并推送到我的自定义 nuget 服务器。

.gitlab-ci.yml:

image: microsoft/dotnet:latest

stages:
  - build
  - pack
  - push
variables:
  project: "GitlabCITest"

before_script:
  - "dotnet restore"
  - "ls -al /builds/test/gitlabcitest/GitlabCITest/nuget.exe"

build:
  stage: build
  variables:
    build_path: "./"
  script:
    - "dotnet build"

pack:
  stage: pack
  script:

    - "cd GitlabCITest"
    - "mkdir tesdosyası"
    - "dotnet pack GitlabCITest.csproj"
    - "ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug"
    - "dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey"

当它运行时,我在推送作业时收到 403 禁止错误。

错误日志:

$ ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug
total 32
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 .
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 ..
-rw-r--r--. 1 root root 3929 Oct 11 06:57 GitlabCITest.1.0.0.nupkg
drwxr-xr-x. 2 root root 4096 Oct 11 06:57 netcoreapp2.1
$ dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey
info : Pushing GitlabCITest.1.0.0.nupkg to 'MyCustomNugetServerAddress'...
info :   PUT MyCustomNugetServerAddress
info :   Forbidden MyCustomNugetServerAddress 651ms
error: Response status code does not indicate success: 403 (Forbidden).

都是关于密码字符的,我有一个';'在我的 apikey 中,所以它变得复杂了。如果您的 apikey 中有特殊字符,只需在 apikey 的开头和结尾添加 ' 字符。 'apikey'