How to use GitLab storage block

Install the collection: pip install prefect-gitlab

Register the blocks:

prefect block register -m prefect_gitlab

Create PAT: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html

Then, use that PAT as secret in your block configuration. You can do that from the UI or from Python:

from prefect_gitlab.credentials import GitLabCredentials
from prefect_gitlab.repositories import GitLabRepository

gitlab_repo = GitLabRepository(
   repository="https://gitlab.com/annageller/prefect.git",
   reference="main",
   credentials=GitLabCredentials(token="GITLAB_ACCESS_TOKEN"))
gitlab_repo.save("default", overwrite=True)

Finally, use that block in your deployment:

prefect deployment build -sb gitlab-repository/default -a