Fix error "fatal: No url found for submodule path in .gitmodules"

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud のみ - この記事は、 クラウド プラットフォームのアトラシアン製品にのみ適用されます。

   

目的

The purpose of this KB article is to provide context as to why this issue may occur and how to address this.

診断

  • A user updates their .gitmodules file to point to a new path for their submodule in another repository

  • The user then attempts to update the git submodules in the remote repository (either using GIT or in Bitbucket Cloud Pipelines) by using some variation of the following command:

    git submodule update --init --recursive
  • They are then met with the following error message - which points to the old path that was previously referenced in their .gitmodules file:
    fatal: No url found for submodule path 'x' in .gitmodules

方法

Essentially, the root cause of the issue is that either the old submodule path remains cached (and must be be removed) or a path does not exist (and must be created) before the submodules may be updated.

To check this, you will need to perform the following on your local repository:

  1. Check the currently configured git submodules by executing the following to verify the submodule path status:


    git submodule status


    If the old path is present:
    You will need to execute the following command to remove this from the cache:


    git rm --cached old/path

    If no path is present:
    To create the mapping reference, enter the following into your .gitmodules file in the root of your repository:



    [
    submodule "path_to_submodule"] path = path_to_submodule url = git://url-of-source/

    path_to_submodule: is the actual path within your repository (relative to the root) where the submodule will be used
    url-of-source: is the URL of the original repository that contains the submodule's files.

  2. Once the above has been actioned, double-check the path configuration before updating the submodules:

    git submodule status
  3. Once complete, execute the same command as prior - you should no longer see the error message:


    git submodule update --init --recursive



  4. Now that the .gitmodules file has been updated with the new path/old path has been removed from cache/updated in the config - you will need to commit the changes and push them to your remote repository to resolve the issue.


If you are still encountering issues after following the steps contained within this knowledge article, please feel free to raise a support ticket or raise a community support ticket for further assistance. 

説明 Bitbucket Cloud - Fix Error "fatal: No url found for submodule path in .gitmodules"
製品Bitbucket Cloud
最終更新日: 2024 年 1 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.