Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46318

Parent remote credentials not used when updating submodules

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Environment:
    • Similar Issues:

      Description

      Hi everyone,

      I'm trying to set up a multibranch pipeline on a repository containing a submodule that lives under the same Github account as my main repository. You'll find a screenshot of the job configuration below.

      However, credentials from the parent (main) repo don't seem to be used to pull the submodule. Therefore, the "checkout scm" step fails with the following 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.
      

      Many thanks in advance for your help.

      -√Čtienne

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          Are your submodules defined to use the same protocol as the parent repository? For example, the submodule credentials implementation assumes that the same credential used for the parent (for example ssh protocol with private key) is used with all the submodules.

          If you clone the parent repository with https but one of your submodules is referenced using ssh protocol (git@github.com or ssh://git.example.com/), then the credentials won't work.

          Show
          markewaite Mark Waite added a comment - Are your submodules defined to use the same protocol as the parent repository? For example, the submodule credentials implementation assumes that the same credential used for the parent (for example ssh protocol with private key) is used with all the submodules. If you clone the parent repository with https but one of your submodules is referenced using ssh protocol (git@github.com or ssh://git.example.com/), then the credentials won't work.
          Hide
          elafarge Etienne Lafarge added a comment -

          Oh indeed. Jenkins was using a token based authentication while my .gitmodules was specifying to use SSH auth.

          I changed the protocol to HTTPS in my .gitmodules and everything seems to work like a charm.

          I'll close the ticket.

          Many thanks Mark !

          Show
          elafarge Etienne Lafarge added a comment - Oh indeed. Jenkins was using a token based authentication while my .gitmodules was specifying to use SSH auth. I changed the protocol to HTTPS in my .gitmodules and everything seems to work like a charm. I'll close the ticket. Many thanks Mark !
          Hide
          elafarge Etienne Lafarge added a comment -

          Wrong protocol was specified: Jenkins was trying to use HTTPS while the ".gitmodules" file indicated to use HTTPS.

          Show
          elafarge Etienne Lafarge added a comment - Wrong protocol was specified: Jenkins was trying to use HTTPS while the ".gitmodules" file indicated to use HTTPS.
          Hide
          elafarge Etienne Lafarge added a comment -

          Problem solved. It was due to the wrong protocol being used.

          Show
          elafarge Etienne Lafarge added a comment - Problem solved. It was due to the wrong protocol being used.

            People

            • Assignee:
              Unassigned
              Reporter:
              elafarge Etienne Lafarge
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: