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

Cannot checkout git repository with submodules: "FATAL: No remotes found!"

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • Master: Jenkins 1.544, Git Plugin 2.0, Ubuntu 13.10 64bit, OpenJDK 1.7.0_25-b30
      Slave: CentOS 6.5 64bit, OpenJDK 1.7.0_45, Git 1.7.1

    Description

      Steps to reproduce
      1. Create a free-style project.
      2. Set "Git Repository URL". The repository specified should use submodules.
      3. In "Additional Behaviours", add "Advanced sub-modules behaviours" and check "Recursively update submodules".
      4. Build it.
      Expected result

      Workspace should have git working tree and submodules.

      Actual console log
      Cloning the remote Git repository
      Cloning repository git://***/*.git
      Fetching upstream changes from git://***/*.git
      Fetching upstream changes from git://***/*.git
      Checking out Revision 0123456789abcdef0123456789abcdef01234567 (origin/master)
      FATAL: No remotes found!
      hudson.plugins.git.GitException: No remotes found!
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getDefaultRemote(CliGitAPIImpl.java:702)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setupSubmoduleUrls(CliGitAPIImpl.java:863)
      	at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:69)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:882)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
      	at hudson.model.Run.execute(Run.java:1502)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      
      Actual .git/config
      [core]
      	repositoryformatversion = 0
      	filemode = false
      	logallrefupdates = true
      

      There is no [remote "origin"] nor [submodule "submodule-name"] sections.

      Workaround

      One of the followings:

      • Downgrade git plugin to 1.5
      • Do not check "Recursively update submodules"
      • Do not checkout git repository with submodules
      • Create a shell build step with: git submodule update --init --recursive

      Attachments

        Activity

          ohtake_tomohiro OHTAKE Tomohiro created issue -
          al74 Andreas Loew added a comment - - edited

          It seems that the problem is not the "git plugin" but the "git client plugin"
          Version 1.4.6 seems to work whereas 1.5.1 does not.

          al74 Andreas Loew added a comment - - edited It seems that the problem is not the "git plugin" but the "git client plugin" Version 1.4.6 seems to work whereas 1.5.1 does not.
          slide_o_mix Alex Earl added a comment -

          I see an issue with missing remotes during the publisher stage as well. The .git/config is missing the remotes section. I don't have submodules at all in my config.

          slide_o_mix Alex Earl added a comment - I see an issue with missing remotes during the publisher stage as well. The .git/config is missing the remotes section. I don't have submodules at all in my config.
          balsamiqluis2 Luis Arias added a comment -

          I had to downgrade the git plugin to 1.5 and the git client plugin to 1.4.6 to get this to work again (With the recursively update submodules option checked in my job).

          balsamiqluis2 Luis Arias added a comment - I had to downgrade the git plugin to 1.5 and the git client plugin to 1.4.6 to get this to work again (With the recursively update submodules option checked in my job).
          ohtake_tomohiro OHTAKE Tomohiro made changes -
          Field Original Value New Value
          Component/s git-client [ 17423 ]
          slide_o_mix Alex Earl added a comment -

          The odd thing is that I have another server with the same versions of the git plugins installed and it has no issues, only the one that was upgraded from a previous version I believe.

          slide_o_mix Alex Earl added a comment - The odd thing is that I have another server with the same versions of the git plugins installed and it has no issues, only the one that was upgraded from a previous version I believe.
          tweese Thomas Weese added a comment - - edited

          Updated

          The main reason is that the remote configuration is not added to .git/config, after adding this manually the submodule update and build process works.

          I'm using the Git Client 1.61 Plugin with Git 1.8.3.4 of my Mac OS X.

          tweese Thomas Weese added a comment - - edited Updated The main reason is that the remote configuration is not added to .git/config, after adding this manually the submodule update and build process works. I'm using the Git Client 1.61 Plugin with Git 1.8.3.4 of my Mac OS X.

          This behaviour also prevents running a "git push" in build scripts as the remote is missing.
          I suspect the switch from clone to init+fetch to be the cause for the missing remotes.

          f_zschocke Florian Zschocke added a comment - This behaviour also prevents running a "git push" in build scripts as the remote is missing. I suspect the switch from clone to init+fetch to be the cause for the missing remotes.

          Manually changing .git/config works, but it is really not sustainable. Was the switch from clone to init+fetch really beneficial? Can we revert that?

          panajev Goffredo Marocchi added a comment - Manually changing .git/config works, but it is really not sustainable. Was the switch from clone to init+fetch really beneficial? Can we revert that?
          rafiki270 Ondrej Rafaj added a comment -

          I have created an additional shell build step with "git submodule update --init --recursive" ... of course I have disabled the sumodule section completely.

          rafiki270 Ondrej Rafaj added a comment - I have created an additional shell build step with "git submodule update --init --recursive" ... of course I have disabled the sumodule section completely.
          rafiki270 Ondrej Rafaj made changes -
          Description h5. Steps to reproduce

          # Create a free-style project.
          # Set "Git Repository URL". The repository specified should use submodules.
          # In "Additional Behaviours", add "Advanced sub-modules behaviours" and check "Recursively update submodules".
          # Build it.

          h5. Expected result

          Workspace should have git working tree and submodules.

          h5. Actual console log

          {code}
          Cloning the remote Git repository
          Cloning repository git://***/*.git
          Fetching upstream changes from git://***/*.git
          Fetching upstream changes from git://***/*.git
          Checking out Revision 0123456789abcdef0123456789abcdef01234567 (origin/master)
          FATAL: No remotes found!
          hudson.plugins.git.GitException: No remotes found!
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getDefaultRemote(CliGitAPIImpl.java:702)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setupSubmoduleUrls(CliGitAPIImpl.java:863)
          at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:69)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:882)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
          at hudson.model.Run.execute(Run.java:1502)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:236)
          {code}

          h5. Actual .git/config

          {code}
          [core]
          repositoryformatversion = 0
          filemode = false
          logallrefupdates = true
          {code}

          There is no [remote "origin"] nor [submodule "submodule-name"] sections.

          h5. Workaround

          One of the followings:

          * Downgrade git plugin to 1.5
          * Do not check "Recursively update submodules"
          * Do not checkout git repository with submodules

          h5. Steps to reproduce

          # Create a free-style project.
          # Set "Git Repository URL". The repository specified should use submodules.
          # In "Additional Behaviours", add "Advanced sub-modules behaviours" and check "Recursively update submodules".
          # Build it.

          h5. Expected result

          Workspace should have git working tree and submodules.

          h5. Actual console log

          {code}
          Cloning the remote Git repository
          Cloning repository git://***/*.git
          Fetching upstream changes from git://***/*.git
          Fetching upstream changes from git://***/*.git
          Checking out Revision 0123456789abcdef0123456789abcdef01234567 (origin/master)
          FATAL: No remotes found!
          hudson.plugins.git.GitException: No remotes found!
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getDefaultRemote(CliGitAPIImpl.java:702)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setupSubmoduleUrls(CliGitAPIImpl.java:863)
          at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:69)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:882)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
          at hudson.model.Run.execute(Run.java:1502)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:236)
          {code}

          h5. Actual .git/config

          {code}
          [core]
          repositoryformatversion = 0
          filemode = false
          logallrefupdates = true
          {code}

          There is no [remote "origin"] nor [submodule "submodule-name"] sections.

          h5. Workaround

          One of the followings:

          * Downgrade git plugin to 1.5
          * Do not check "Recursively update submodules"
          * Do not checkout git repository with submodules
          * Create a shell build step with: git submodule update --init --recursive

          benmonro Ben Monro added a comment -

          Any update on this? This is a severe problem. I have to use submodules and none of the workarounds worked.

          benmonro Ben Monro added a comment - Any update on this? This is a severe problem. I have to use submodules and none of the workarounds worked.

          @Goffredo init+fetch was actually required, there's no option on git-cli to pass credentials - misconception imho, but have to live with this limitation

          ndeloof Nicolas De Loof added a comment - @Goffredo init+fetch was actually required, there's no option on git-cli to pass credentials - misconception imho, but have to live with this limitation

          I guess this has been fixed by 9871e3c81f9f51950edc9cb0f2674304f554fb39

          ndeloof Nicolas De Loof added a comment - I guess this has been fixed by 9871e3c81f9f51950edc9cb0f2674304f554fb39
          markewaite Mark Waite added a comment -

          git-plugin 2.0.1 and git-client-plugin 1.6.2 include the fix for this.

          Future versions of git-client-plugin (after 1.6.2) will have the further refinement that the plugin consistently assigns a remote when cloning, whether using JGit or command line git, and whether the internal implementation is a clone or an init and fetch.

          markewaite Mark Waite added a comment - git-plugin 2.0.1 and git-client-plugin 1.6.2 include the fix for this. Future versions of git-client-plugin (after 1.6.2) will have the further refinement that the plugin consistently assigns a remote when cloning, whether using JGit or command line git, and whether the internal implementation is a clone or an init and fetch.
          markewaite Mark Waite made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          markewaite Mark Waite made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 152919 ] JNJira + In-Review [ 207257 ]

          People

            ndeloof Nicolas De Loof
            ohtake_tomohiro OHTAKE Tomohiro
            Votes:
            22 Vote for this issue
            Watchers:
            34 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: