Answers: <p>I believe that what you need is just a <a href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" rel="nofollow noreferrer">Personal Access Token</a>, or if you're a maintainer, possibly a <a href="https://docs.gitlab.com/ee/user/project/deploy_tokens/" rel="nofollow noreferrer">Deploy Token</a>. It's <em>much</em> safer than embedding user credentials.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-10-03T04:38:50.943Z
Answers: Personal Access token worked for me, thanks. As Deploy tokens don't provide write_repository scope, that didn't worked. I'm explaining the steps here: https://medium.com/@neronjoseph.sep/tag-your-git-repo-using-gitlabs-ci-cd-pipeline-a7963c2274d2
Answers: Neron Joseph
Answers: CC BY-SA 4.0
Answers: 2020-09-21T16:04:53.897Z
Answers: 2020-09-21T16:04:53.897Z
Answers: XML
Body: <p>I was trying to tag a git branch using Gitlab CI. With the help of this answer from this community,</p>
  <blockquote>
  <p><a href="https://devops.stackexchange.com/questions/3794/how-to-tag-source-code-using-gitlabci">How to tag source code using gitlabCI</a></p>
  </blockquote>
  <p>I can successfully tag a git branch from Gitlab CI pipeline. But In that method, I noticed that we need to provide the gitlab credentials in that pipeline code. I know, we can pass that as Gitlab environment variables.</p>
  <p>But I just need to know, is there any other method to do this operation? With a Key or Token or something rather than direct username and password?</p>
  <p>Not sure whether my question legit? I was thinking about the security side of it.</p>
  
Tags: <git><gitlab><cicd>
Title: Is there any other approach for tagging git branch using pipeline without credentials in pipeline code?
UserDisplayName: Neron Joseph
ThreadText: # Is there any other approach for tagging git branch using pipeline without credentials in pipeline code?
  
  (Asked by: username_0 on 2020-09-21)
  
  I was trying to tag a git branch using Gitlab CI. With the help of this answer from this community,
  
  > [How to tag source code using gitlabCI](https://devops.stackexchange.com/questions/3794/how-to-tag-source-code-using-gitlabci)
  
  I can successfully tag a git branch from Gitlab CI pipeline. But In that method, I noticed that we need to provide the gitlab credentials in that pipeline code. I know, we can pass that as Gitlab environment variables.
  
  But I just need to know, is there any other method to do this operation? With a Key or Token or something rather than direct username and password?
  
  Not sure whether my question legit? I was thinking about the security side of it.
  
  **Tags:** git, gitlab, cicd
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-09-21. Score: 2 | Accepted answer
  
  I believe that what you need is just a [Personal Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html), or if you're a maintainer, possibly a [Deploy Token](https://docs.gitlab.com/ee/user/project/deploy_tokens/). It's *much* safer than embedding user credentials.
  
  > **Comments:**
  > **username_0**: Personal Access token worked for me, thanks. As Deploy tokens don't provide write_repository scope, that didn't worked. I'm explaining the steps here: https://medium.com/@username_0.sep/tag-your-git-repo-using-gitlabs-ci-cd-pipeline-a7963c2274d2  
  
  ---
  
  