glab variable set API_KEY -v "s3cr3t" --masked --protected

Category: GitLab

glab variable set API_KEY -v "s3cr3t" --masked --protected

Create a masked protected CI/CD variable

Stores the value s3cr3t as the API_KEY variable, visible only in masked form in job logs. Masked values hide in pipeline output, and protected values only reach protected branches and tags. Update an existing key by setting it again.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.