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

Parent remote credentials not used when updating submodules

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major

      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

          [JENKINS-46318] Parent remote credentials not used when updating submodules

          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.

          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.

          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 !

          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 !

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

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

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

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

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

              Created:
              Updated:
              Resolved: