Curl returns 404 and I don't know why

Replace this template with your information

I want to curl and pull a file from a private repository. It’s not working, and I’m can’t see how

  • *In the CI this happens

(Assume all variables are set correctly)

CI runs a script that parses a file for a value (billy.smith.asc), and looks in the repository 21042317: /dev/billy.smith.asc

curl -f --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/21042317/repository/files/dev%2Fbilly%2Dsmith%2Easc/raw?ref=develop" -o "$_script_dir/"${FIRST}-${LAST}.asc

From output when -v is used
... > GET /api/v4/projects/21042317/repository/files/dev%2Fbilly%2Dsmith%2Easc/raw?ref=develop HTTP/2 > Host: gitlab.com > user-agent: curl/7.69.1 > accept: / > job-token: [MASKED]`

The requested URL returned error: 404
…`

Running from my test repo, this works.

Again, assume all variables are correct. TEST_PROJECT_ID is a repository I stood up with dummy values to test the idea.

TEST_FILE_PATH: "user%2Ftacen%2Ddevops%2Ecsv"

curl -s -f --header "PRIVATE-TOKEN: $TEST_TOKEN" "https://gitlab.com/api/v4/projects/${TEST_PROJECT_ID}/repository/files/{$TEST_FILE_PATH}/raw?ref=master" -o "$_script_dir/"${GPG_FILE}

  • What version are you on? Are you using self-managed or GitLab.com?

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I’ve tried many things and am simply confused at this point.

My gitlab doc reference is Repository files API | GitLab