I am working on CI/CD pipeline (GitLab) build and I want to update my submodule. ( In local git submodule update --init --recursive --remote
works well). But the same thing in the pipeline gives the below error:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I try to use git submodule update --init --recursive --remote
command in the scripts section. But it works well in the terminal.
You need to create project access tokens, if you don't have permissions ask the admin to create
To create a project access token:
Edit the .gitmodules file from your project. Enter the newly created username and token below
url = https://$(USERNAME):$(PROJECT_ACCESS_TOKEN)@github.com/user/repository.git
Set the GIT_SUBMODULE_STRATEGY : normal
in your CI/CD