We want to cooperatively write a scientific paper in LaTeX. We are using a GitLab repository for this. What we have managed so far is that we can compile our LaTeX file into a PDF. This is then made available as an artefact. What we want to achieve, however, is that we push the generated PDF file into our repository via CI.
I received following error message:
$ git clone "https://${CI_USERNAME}:${CI_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "${CI_COMMIT_SHA}"
Cloning into 'bf2fa940a042cf923003496ae3f8e551bf43de7d'...
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.informatik.hs-furtwangen.de/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.informatik.hs-furtwangen.de/labore/forschung/mqttros.git/'
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: command terminated with exit code 1
I have now created a Personal Access Token, a Project Access Token and a Deploy Access Token. But I cannot log in. I have orientated myself on two variants:
https://gist.github.com/bkirova/b4cb80b4480431ba0f54c59626e34f3c#file-gitlab-ci-yml
and I don't have a link from the other one at the moment. I also tried a solution from Stack Overflow and got the same error message.
My .gitlab-ci.yml
looks like this:
compile_pdf:
stage: build
image: registry.gitlab.com/islandoftex/images/texlive:latest
script:
- pdflatex Paper/mqttrosmain.tex
# - bibtex Paper/mqttrosmain
- pdflatex Paper/mqttrosmain.tex
after_script:
- cat essay.log
artifacts:
paths:
- mqttrosmain.pdf # instruct GitLab to keep the main.pdf file
pages:
stage: deploy
script:
- apt update && apt install git -y
- git clone "https://${CI_USERNAME}:${CI_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "${CI_COMMIT_SHA}"
- echo "cloning finished"
- git config --global user.email "${GIT_USER_EMAIL:-$CI_EMAIL}"
- git config --global user.name "${GIT_USER_NAME:-$CI_USERNAME}"
- git config --system --unset credential.helper
- echo "unset crendential helper finished"
- cd "${CI_COMMIT_SHA}"
- mkdir public # create a folder called public
- cp mqttrosmain.pdf public # copy the pdf file into the public folder
- git add -A
- git commit -m "Upload Paper"
- git push origin "${CI_DEFAULT_BRANCH}" -o ci.skip
artifacts:
paths:
- public # instruct GitLab to keep the public folder
only:
- main # deploy the pdf only for commits made to the main branch
I hope you can help me. Thanks in advance.