1

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.

Azeem
  • 11,148
  • 4
  • 27
  • 40

1 Answers1

1

You need to create project access tokens, if you don't have permissions ask the admin to create

To create a project access token:

  1. On the top bar, select Main menu > Projects and find your project.
  2. Settings > Access Tokens.
  3. Enter a name.
  4. Select a role for the token.
  5. Select Create 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

arpit.xl
  • 121
  • 2