I'm trying to do change in a file during a job in a pipeline i'm developing and then commit that change to the master branch of the same project, but I'm having a hard time making it work.
Here's the job:
maven_next_release:
stage: next-version
dependencies:
- maven_test
before_script:
- apt update && apt-get install git perl-base -yrelease-demo.git
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git fetch
- git checkout master
script:
- cat VERSION
- perl -i -pe 's/\d+\.\d+\.\K(\d+)/ $1+1 /e' VERSION
- echo $(cat VERSION)-SNAPSHOT > VERSION
- cat VERSION
- git add VERSION
- git commit -m "[skip ci]New version $(cat VERSION)"
- git push https://${GIT_USERNAME}:${GIT_PASSWORD}@gitlab.com/myproject/release-demo.git
only:
- tags
except:
- branches
So, everything seems to work except for the push command. Here's the log:
$ git push https://${GIT_USERNAME}:${GIT_PASSWORD}@gitlab.com/myproject/release-demo.git
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/myproject/release-demo.git/'
I'm really not sure what to do, I read about settting a SSH Key so I don't have to pass user and password, but I'm not sure how to generate a SSH key for the runner.