Project email access token is not a project team member

I created a personal access token in the project so that when I created a tag it would update the version of a file and commit again and sends it to main branch.

Project is inside hosted

Suppose the project id is 12345 and the email created after creating the project access token is

The tag update script would look like this:

   stage: update
     BRANCH_TAG: main
     - apk add git curl jq
     - mkdir /update-project && cd /update-project
     - git clone ${PROJECT_REPO}
     - git config --global "${PROJECT_EMAIL_BOT}"
     - git config --global "'${PROJECT_NAME_BOT}'"
     - pwd
     - cd project-x/
     - jq --arg tag "${CI_COMMIT_TAG}" '.version=$tag' composer.json > new_composer.json
     - mv new_composer.json composer.json
     - cat composer.json
     - git add composer.json
     - git commit -m "Update version ${CI_COMMIT_TAG} in composer.json"
     - git log -1
     - git tag --force ${CI_COMMIT_TAG}
     - git push origin ${BRANCH_TAG} --force
     - git push -o ci.skip origin ${CI_COMMIT_TAG} --force
     - tags

The error you are giving is this through the log:

$ git push origin ${BRANCH_TAG} --force
remote: GitLab: Author '' is not a member of team
  ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://project_12345_bot:[ACCESS_TOKEN]'

It used to work, but now it’s not working anymore, it says that the gitlab email is not a team member, but it is the PROJECT_ACCESS_TOKEN email.

Would you help me?

Just for others that come across this when you have Authorize using gitlab email option selected. You can find the bot email by:

  1. Go to the Project with the Access Token created
  2. Project Information > Members
  3. search “bot” & click the one you are after
  4. click the View user in admin area button (top right)
  5. Use the exact email listed under the Account properties.

For my on prem version, the email differs from the username slightly. i.e. missing first “_” & was set with