Docs feedback: Get raw file from repository -- need a branch example

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

This document here:

https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository

I have a branch named "_ubuntu-pgi-openmpi.selene/_Dockerfile". I tried to use the instructions to fetch it using these 6 forms

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile/_Dockerfile/raw?ref_type=_ubuntu-pgi-openmpi.selene/_Dockerfile' -o Dockerfile

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile/_Dockerfile/raw?ref=_ubuntu-pgi-openmpi.selene/_Dockerfile' -o Dockerfile

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile%2FDockerfile/raw?ref_type=_ubuntu-pgi-openmpi.selene%2F_Dockerfile' -o Dockerfile

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile%2FDockerfile/raw?ref=_ubuntu-pgi-openmpi.selene%2F_Dockerfile' -o Dockerfile

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile/_Dockerfile/raw?branch=_ubuntu-pgi-openmpi.selene/_Dockerfile' -o Dockerfile

  curl -H "PRIVATE-TOKEN: $TOKEN" 'https://gitlab.com/api/v4/projects/17482517/repository/files/_ubuntu-pgi-openmpi.selene%2F_Dockerfile/_Dockerfile/raw?branch=_ubuntu-pgi-openmpi.selene%2F_Dockerfile' -o Dockerfile

none of which worked, so I can't tell how I'm supposed to do this.

Edited Sep 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading