0

I have a stage at the end of my pipeline job which has to push changes back to a particular Gitlab branch. After trying out several solutions proposed on stackoverflow, I am still not able to push to the branch

sh("git add .")
sh("git commit -a -m ' New changes'")
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@<REPO> ')

I expected it to be pushed to the branch which it checked out from but I get the following result on the console

  • git commit -a -m ' New changes' [detached HEAD bc78567] New changes
  • Everything up-to-date

any reason for this issue?

Leroi
  • 349
  • 4
  • 21

1 Answers1

0

Looks like you have a detached HEAD in your local repo clone because the commit you are trying to push is not a branch head. Check this link out and you may have to run some commands on jenkins node to get it to sync up with the branch. In gitk, why is my yellow button above master?

Sushant Sonker
  • 132
  • 1
  • 5