Question regarding "git tag"?

I want to create a tag in my .gitlab-ci.yml, and push it to the git repository.

$ git push origin --tag
remote: You are not allowed to upload code.

How do I create that authority? Is there a key or a token I can set up for write access to the git repository from .gitlab-ci.yml?

This would seem to be a common task but I’m not finding any hints from google.

Hi @agapanthusblue
you need to prepare Deploy Key or Project Access Token depending if you are on or self-hosted. Set it up in you pipeline for git client. There are multiple options how to do it.
You can use your favourite search engine and search for ‘gitlab push from pipeline’

@agapanthusblue I have to admit I am not sure I understand your question, so please accept this input as I have learned how to commit changes to gitlab with tags.

Say you have a working directory of /home/agapanth/your_work and all of your code resides here, along with your .git subdir residing in this path precisely.

And your code is at version 1.3.0, and you wish to tag it as “Rev-1.3.0” specifically (for this example).
You would do the following:

Change into working directory:

cd /home/agapanth/your_work

Add working directory contents into staging directory contents:

git add -A .

Tag the based on the term “Rev-1.3.0” with a human-interesting-message:

git tag -a Rev-1.3.0 -m "Commiting changes that make this Rev-1.3.0"

Confirm your tag was “received” in the staging copy:

git show

Send your change up to the Gitlab Repository (already defined in “origin”):

git push -i origin  Rev-1.3.0

Pardon my ignorance if this has nothing to do with what you are trying to accomplish.

Thanks. Yes, that’s the manual process. It’s the authentication while running from .gitlab-ci.yml that has me stumped so far.

I haven’t had a chance to explore the google terms @balonik suggested.

1 Like

Unfortunately you need to proceed like @balonik suggested. There are several open issues how the scope of CI_JOB_TOKEN should be extended but there is little progress.